lundi 7 juillet 2014

Passing strings as arguments in dplyr verbs


Vote count:

0




I would like to be able to define arguments for dplyr verbs



filter1<- "!is.na(attend)"
filter2<- "is.na(attend)"


and then use these strings in dply functions :



ds1<- ds %>%
filter(eval(cat(filter2)))
ds2<- ds %>%
filter(eval(cat(filter1)))


But it throws in error



!is.na(attend)
Error: filter condition does not evaluate to a logical vector.


How to pass a string as an argument in a dplyr verb?



asked 49 secs ago

andrey

160





Aucun commentaire:

Enregistrer un commentaire