1

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?

Hein
  • 33
  • 1
  • 4

1 Answers1

0

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

geoffjentry
  • 4,674
  • 3
  • 31
  • 37
  • Thank you for the answer. I tried your recommendation but I still get the as.environment error I described in my question. I thought it had something to do with my company's firewall and tried wi-fi. Same problem. So I cannot get past the credentials step. – Hein Aug 06 '13 at 09:06
  • I managed to sort the problem out. I upgraded to R Version 3.0.1 and installed the latest version of all the packages needed. The error did not appear again. – Hein Aug 06 '13 at 11:38
  • I see a lot of users talk about `download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem") twitCred$handshake(cainfo="cacert.pem")`. This is not part of the getTwitterOAuth package. Does this matter? – Hein Aug 15 '13 at 11:30
  • @Hein that is the root certificates which are taken from Firefox. If you are happy to use them it is fine. Did it fix your problem? – Christopher Hackett Sep 30 '13 at 15:31