cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MohanV Established Member
Established Member

R script Getting Error Unable to translate bytes

Hello All,

I am trying to ger the twitter data using R script in power bi desktop.

Here is the script that i have used to get the twitter data.

library(twitteR)
source("authenticate.R")
tweets <- searchTwitter("Virat",n = 100,lang = "en")
tweetsdf <- twListToDF(tweets)

Details: "Unable to translate bytes [ED][A0] at index 127 from specified code page to Unicode."

 

It is running fine and am able to get the tweets in R studio, but not in Power Bi R script.

 

Please suggest me.

1 ACCEPTED SOLUTION

Accepted Solutions
MohanV Established Member
Established Member

Re: R script Getting Error Unable to translate bytes

Hi @KumarDarmesh

 

I have solved this issue by using stringi package.

here is the script that i have used.

 

library(twitteR)
library(stringi)

tweets <- searchTwitter(search_term, number_of_tweets )
#convert received data to something PowerBi understands
df_tweets <- twListToDF(tweets)

#column clean
df_tweets$text <- stri_encode(df_tweets$text, "", "UTF-8")

It cleans the column which are not understandable.

2 REPLIES 2

Re: R script Getting Error Unable to translate bytes

Could you post the completed code? I did download the twitteR and OATH package, however not yet to run your R script.

MohanV Established Member
Established Member

Re: R script Getting Error Unable to translate bytes

Hi @KumarDarmesh

 

I have solved this issue by using stringi package.

here is the script that i have used.

 

library(twitteR)
library(stringi)

tweets <- searchTwitter(search_term, number_of_tweets )
#convert received data to something PowerBi understands
df_tweets <- twListToDF(tweets)

#column clean
df_tweets$text <- stri_encode(df_tweets$text, "", "UTF-8")

It cleans the column which are not understandable.