我正在使用R中的twitteR软件包来更新我的Twitter状态和分析结果。静态推文功能有效:
library(twitteR)
sess = initSession('username','password')
tweet = tweet('I am a tweet', sess)
但是,当我添加一个变量来显示某些特定结果时,我收到一个错误。
library(twitteR)
sess = initSession('username','password')
res = c(3,5,8)
msg = cat('Results are: ', res, ', that is nice right?')
tweet = tweet(msg, sess)
结果:
Error in twFromJSON(rawToChar(out)) :
Error: Client must provide a 'status' parameter with a value.
任何建议都表示赞赏。
答案 0 :(得分:3)
这是我运行代码时得到的结果:
> res = c(3,5,8)
> msg = cat('Results are: ', res, ', that is nice right?')
Results are: 3 5 8 , that is nice right?>
> msg
NULL
问题是cat
将字符串打印到stdout,而不是将它们作为字符串返回。你想要的是:
> res = c(3,5,8)
> msg = paste('Results are: ', toString(res), ', that is nice right?', sep='')
> msg
[1] "Results are: 3, 5, 8, that is nice right?"