0

I have a word list like so in vector called inf_mention: inf_mention contains words like: happy, well, good and is taken from a column of another dataset (not sure if this is important or not).

I have another dataframe and I'm creating a new column inf which I'd like to put a 1/0 (or true/false) against if there is a mention of any of the word in inf_mention

    td$inf[grepl(paste(inf_mention, collapse = "|"), td$Tweet.text)] <- TRUE

I get all NA s as an output when I check the str(td) on that column. What I'm ultimately trying to do is to get monthly count of mentions of inf if I use table, then it just cuts by month and counts all instances and not a column. Any assistance would be much appreciated.

maric
  • 79
  • 1
  • 11
  • could you please show us some data? Would be easier to help. You can use `dput` and, overall, [these indications](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). – Vincent Bonhomme May 02 '16 at 06:15
  • 1
    Try `as.integer(grepl(paste(inf_mention, collapse = "|"), td$Tweet.text))` – akrun May 02 '16 at 06:26

0 Answers0