I am working with a survey where participants answer the first question with yes or no and then a second open-ended question "if yes, why?"
I need to find out the percentage of people who answer the second question after saying "yes". Or alternatively, I need to find the number of 'NA's after they answer "yes".
Here is a similar-looking dataset:
#>      helpful     helpfulhow               
#> 1    n           NA
#> 2    y           Because this study cannot be put online. Thus I have to create a random wall of text    
#> 3    n           NA         
#> 4    y           This is a confidential study. Thus the data must be changed.
#> 5    n           NA   
#> 6    n           NA
#> 7    y           This is a confidential study. Thus the data must be changed every time. 
#> 8    y           NA
#> 9    y           Qualitative studies are difficult to assess. Here is a random wall of text.
> str(b)
'data.frame':   9 obs. of  2 variables:
 $ helpful   : Factor w/ 2 levels "n","y": 1 2 1 2 1 1 2 2 2
 $ helpfulhow: Factor w/ 4 levels "Because this study cannot be put online. Thus I have to create a random wall of text.",..: NA 1 NA 4 NA NA 3 NA 2
> dput(head(b))
structure(list(helpful = structure(c(1L, 2L, 1L, 2L, 1L, 1L), .Label = c("n", 
"y"), class = "factor"), helpfulhow = structure(c(NA, 1L, NA, 
4L, NA, NA), .Label = c("Because this study cannot be put online. Thus I have to create a random wall of text.", 
"Qualitative studies are difficult to assess. Here is a random wall of text.", 
"This is a confidential study. Thus the data must be changed every time.", 
"This is a confidential study. Thus the data must be changed."
), class = "factor")), row.names = c(NA, 6L), class = "data.frame")
So for example, I want to find out how many people who put 'y's under helpful also put 'NA' under helpfulhow. Thanks in advance.
 
     
    