Over at Cerebral Mastication, you can find the code for a function that will allow you to send a status update to Twitter directly from the R console. The code’s pretty short, so here it is in full:
library(“RCurl”)
opts <->curlOptions(header = FALSE,
userpwd = “username:password”, netrc = FALSE)tweet <->function(status){
method <->“http://twitter.com/statuses/update.xml?status=”
encoded_status <->URLencode(status)
request <->paste(method,encoded_status,sep = “”)
postForm(request,.opts = opts)
}
tweet(“This tweet comes from R! #rstats”)
Over at Cerebral Mastication, you can find the code for a function that will allow you to send a status update to Twitter directly from the R console. The code’s pretty short, so here it is in full:
library(“RCurl”)
opts <- curlOptions(header = FALSE,
userpwd = “username:password”, netrc = FALSE)tweet <- function(status){
method <- “http://twitter.com/statuses/update.xml?status=”
encoded_status <- URLencode(status)
request <- paste(method,encoded_status,sep = “”)
postForm(request,.opts = opts)
}
tweet(“This tweet comes from R! #rstats”)
Leave a Review