How to authenticate the twitter credentials object in R

twitter

#1

hello,

I am trying to do sentiment analysis in R using twitter data and below is my code for it:

install.packages("twitteR")
install.packages("ROAuth")
library(twitteR);library(ROAuth);

# Download "cacert.pem" file
download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem")

#create an object "cred" that will save the authenticated object that we can use for later sessions
cred <- OAuthFactory$new(consumerKey='xxcxcxcx',
                         consumerSecret='vnbvnbvbv,
                         requestURL='https://api.twitter.com/oauth/request_token',
                         accessURL='https://api.twitter.com/oauth/access_token',
                         authURL='https://api.twitter.com/oauth/authorize')

# Executing the next step generates an output --> To enable the connection, please direct your web browser to: <hyperlink> . Note:  You only need to do this part once
cred$handshake(cainfo="cacert.pem")

#save for later use for Windows
save(cred, file="twitter authentication.Rdata")

load("twitter authentication.Rdata")
registerTwitterOAuth(cred)

However this gave me an error:

which i found out is because we can use the below option:

setup_twitter_oauth('hghgh','bhbhbhb','jhjhjh','hghghgh')

in place of Routh,but even this is giving an error:

Why is this error coming and how do i rectify it??


#2

Its authentication error…
You should install base64enc package and Use TwitteR package by Geoff with dependencies true…
then run the above code…let me know if there is any other problem.