tags:

views:

92

answers:

1

Hello, I am using the twitteR package in R to update my twitter status with results from analysis. The static tweet function works:

library(twitteR)

sess = initSession('username','password')

tweet = tweet('I am a tweet', sess)

However, when I add a variable to display some specific results I get an error.

library(twitteR)

sess = initSession('username','password')

res = c(3,5,8)
msg = cat('Results are: ', res, ', that is nice right?')

tweet = tweet(msg, sess)

Results in:

Error in twFromJSON(rawToChar(out)) : 
  Error: Client must provide a 'status' parameter with a value.

Any suggestions are appreciated.

+3  A: 

Here's what I get when I run bits of your code:

> 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

The problem is that cat prints strings to stdout, rather than returning them as a string. What you want is:

> 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?"
rescdsk
awesome, that worked perfectly. thanks for the advice.
analyticsPierce

related questions