ruviansh
ruviansh

Reputation: 105

Cannot coerce type 'environment' to vector of type 'character' - Twitter

tw_id<-read.delim('all_ids.tsv.chunk001') # contains only tweet ids

tw_id[3] <- paste(c(1:nrow(tw_id)))  #creating 3rd col to hold tweets

  tweet_id<-paste(tw_id[1,2])   #pass 1st tweet id to variable

  tweet<-showStatus(tweet_id)  #pass 1st tweet into variable

  do.call("rbind",lapply(tweet,as.data.frame)) # convert tweet into data frame


Error in as.data.frame.default(X[[1L]], ...) : 
  cannot coerce class "structure("defaultBindingFunction", package = "methods")" to a data.frame

How do I convert twitter attributes an Environment variable into a string/numeric.

Have tried paste functions. Same error.

Need them in readable format alongside other columns.

Thanks.

Upvotes: 0

Views: 13082

Answers (1)

ruviansh
ruviansh

Reputation: 105

I was trying to pass the whole environment variable while I simply needed the text attribute. Solved it now.

 do.call("rbind", lapply(tweet$text, as.character))

Upvotes: 2

Related Questions