twitteR and ROAuth with as.environment error

351 views Asked by At

I am very new to the Twitter environment. I am trying to analyse Twitter messages using twitteR. I am having trouble with the ROauth package. I followed the instructions in the ROAuth package documentation but I still get an error message. Here is what I do and the message I get.

> reqURL <-"https://api.twitter.com/oauth/request_token"
> authURL <- "https://api.twitter.com/oauth/authorize"
> accessURL <- "https://api.twitter.com/oauth/access_token"
> cKey <- "xxxxxxxx"
> cSecret <- "xxxxxxxxxx"
> credentials <- OAuthFactory$new(consumerkey=cKey, 
 consumerSecret=cSecret,requestURL=reqURL, accessURL=accessURL, authURL=authURL)

Error in as.environment(x) : invalid object for 'as.environment'

I tried changing the https to http but nothing changed. My session information is as follows:

R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_South Africa.1252  LC_CTYPE=English_South Africa.1252   
[3] LC_MONETARY=English_South Africa.1252 LC_NUMERIC=C                         
[5] LC_TIME=English_South Africa.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ROAuth_0.9.3   digest_0.6.2   RCurl_1.95-4.1 bitops_1.0-5  

loaded via a namespace (and not attached):
[1] tools_2.15.2

I also installed R version 3.0.1 but I had the same issue. Can someone please help?

1

There are 1 answers

4
geoffjentry On

Try using this instead of all of that jazz:

cred = getTwitterOAuth(YOURKEY, YOURSECRET)

This simplifies the process and manages to cut out a lot of errors caused by small differences