setup_twitter_oauth,searchTwitter和Rscript

时间:2015-02-20 15:29:32

标签: r twitter crontab rscript

我使用Linux服务器上的RStudio安装运行以下脚本。

require(twitteR)
require(plyr)

setup_twitter_oauth(consumer_key='xxx', consumer_secret='xxx', 
                    access_token='xxx', access_secret='xxx')

searchResults <- searchTwitter("#vds", n=15000, since = as.character(Sys.Date()-1), until = as.character(Sys.Date()))
head(searchResults)

tweetsDf = ldply(searchResults, function(t) t$toDataFrame())
write.csv(tweetsDf, file = paste("tweets_vds_", Sys.Date(), ".csv", sep = ""))

当我从用户界面运行脚本时,脚本运行正常。

但是,当我使用crontab通过终端自动运行它时,收到以下错误消息:

[1] "Using direct authentication"

Error in twInterfaceObj$getMaxResults : 
  could not find function "loadMethod"
Calls: searchTwitter -> doRppAPICall -> $
Execution halted

为什么?

0 个答案:

没有答案