I’m using twitteR packages (and all needed packages), which are all latest version to do “Lynas Malaysia” twitter sentiment analysis.
The source code is as below:
library(twitteR)
library(plotrix)
dontshowtweet <- 0
showtweetyesterday <- searchTwitter("lynas", n=1000,
date=as.character(Sys.Date()-7))
sources <- sapply(showtweetyesterday, function(x) x$getScreenName())
sources <- gsub("</a>", "", sources)
sources <- strsplit(sources, ">")
sources <- sapply(sources, function(x) ifelse(length(x) > 1, x[2], x[1]))
pie(table(sources),
main = "Who is tweeting about me")
length(showtweetyesterday)
df <- twListToDF(showtweetyesterday)
df[1:1000,c(10,4)] #screen name & created date
length(showtweetyesterday)
I still faced error, caused by RCurl. By using warnings(), I got:
In mapCurlOptNames(names(.els), asNames = TRUE) :
Unrecognized CURL options: date
How to solve this error?
Thanks.
According to the manual, the
searchTwitterfunction has nodateargument: you probably wantsinceinstead.