I am new to R, can someone please what is wrong with my code? I want to filter my result to only show people who have answered “no” but my result generate 0 rows. I also tried another code but it gives me 3 rows and not 1. Does it have anything to do with the fact that my data is stored as factors and not characters?
I also tried another code but gave me three rows, what am I doing wrong?
Thanks in advance,
brfss2013 %>% + select(hivtst6) %>% + str()
=‘data.frame’: 491775 obs. of 1 variable:
$ hivtst6: Factor w/ 2 levels “Yes”,“No”: 2 1 1 2 2 1 2 2 2 2 …
brfss2013 %>% filter(as.character(hivtst6) == "yes") %>% group_by(hivtst6) %>% summarise(count = n())
brfss2013 %>% filter (hivtst6 != "yes") %>% group_by(hivtst6) %>% summarise(count = n()) ste code here