[datatable-help] My filter is not working

christinelly 01chrikelly at gmail.com
Mon Oct 9 21:20:48 CEST 2017


Hello,

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
generates 0 rows. 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,
Christine

'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())

<http://r.789695.n4.nabble.com/file/t385588/Screen_Shot_2017-10-09_at_21.png> 



--
Sent from: http://r.789695.n4.nabble.com/datatable-help-f2315188.html


More information about the datatable-help mailing list