Skip to content
This repository has been archived by the owner on Apr 11, 2019. It is now read-only.

showStatus function in TwitteR package returns error #68

Open
rishianand7 opened this issue Oct 3, 2014 · 2 comments
Open

showStatus function in TwitteR package returns error #68

rishianand7 opened this issue Oct 3, 2014 · 2 comments

Comments

@rishianand7
Copy link

Hi,
I am getting the following error while trying to run the showStatus function on twitter ID's in order to return the various attributes of the tweet such as text, creation date, user ID etc.
image

Note: The function runs and returns the desired output for 3-4 ID's before the error shown above pops up and the code stops executing.

What can be done to tackle the issue. I have installed the latest version of the package from github.

Cheers!

@geoffjentry
Copy link
Owner

Hi - can you provide a reproducible example?

@rishianand7
Copy link
Author

Hi,

Im running the following lines of code on a file that contains a list of 5390 tweet ID's that are separated by commas.

install.packages(c("devtools", "rjson", "bit64", "httr"))
library(devtools)
library(rjson)
library(bit64)
library(httr)
install_github("twitteR", username="geoffjentry")
library(twitteR)
api_key <- "XXXX"
api_secret <- "XXXX"
access_token <- "XXXX"
access_token_secret <- "XXXX"
setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)

x<-read.table("file.txt", sep=",",header=FALSE) ## reads the file
x<-t(x) ## takes transpose of file
x<-as.data.frame(x) ## converting to data frame
x$Text<-c(1:dim(x[1])) ## creates new column for storing text from tweet at later stage
x$Created<-c(rep(Sys.time(),5390)) ## creates new column for storing creation date of tweet
x[,2]<-as.character(x[,2]) ## converts Text column to character

colnames(x)<-c("TweetID","Text","Created")

for(i in 1:5390)
{
m<-showStatus(x$TweetID[i], map=TRUE) ## retrieves tweet information for first ID in list
x$Text[i]<-m$text ## stores text from tweet in corresponding column
x$Created[i]<-m$created ## stores creation date of tweet in corresponding column
}

On running the code above, I encounter the error stated in the previous message and only 3-4 rows get populated. If you would like to test the code above you could do the same by reading the following bunch of tweet IDs (i used the ID's mentioned below):

{388775704751398913,388775707973009409,388775712439549952,388775737077284864,388775738704269312,388775789103042560,388775807222423553,388775816135708673,388775816328273920,388775828517302272,388775851136794624,388775858531344384,388775863338029056,388775865917915136,388775873819979776,388775875564404736,388775881998487552,388775890932338688,388775891125678080,388775910524329984}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants