Search code examples
rtwittertext-miningtm

what is getText function in text-mining? Where does it come from? [r]


I am following a text-mining example from Social Media Mining with R by Nathan Dannerman & Richard Heimann : The Book . After pulling tweets using searchTwitter function, the author uses sapply on the list to extract the text portion like this:

rstats <- searchTwitter("#rstats", n = 1000)

rstats_list <- sapply(rstats, function (x) x$getText())

This neatly makes a character vector with only the text portion from the tweets. What is getText() ? I can't find anything on it anywhere - the author has not sufficiently explained. I looked at the tm package documentation - nothing! I looked for questions related to this on SO - Getting Text From Tweets The answerer is asking the same question as I. On Inside-R, I found this: http://www.inside-r.org/r-doc/base/gettext but it's not the same as getText . Can someone explain what I am missing?


Solution

  • getText is an accessor method for the 'status' class, as described here: http://www.inside-r.org/howto/mining-twitter-airline-consumer-sentiment.

    Sorry for not clarifying in the text, Nathan Danneman