<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic R script Getting Error Unable to translate bytes in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/130538#M4480</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I am trying to ger the twitter data using R script in power bi desktop.&lt;/P&gt;&lt;P&gt;Here is the script that i have used to get the twitter data.&lt;/P&gt;&lt;PRE&gt;library(twitteR)
source("authenticate.R")
tweets &amp;lt;- searchTwitter("Virat",n = 100,lang = "en")
tweetsdf &amp;lt;- twListToDF(tweets)&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Details: "Unable to translate bytes [ED][A0] at index 127 from specified code page to Unicode."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is running fine and am able to get the tweets in R studio, but not in Power Bi R script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2017 09:07:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-02-21T09:07:57Z</dc:date>
    <item>
      <title>R script Getting Error Unable to translate bytes</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/130538#M4480</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I am trying to ger the twitter data using R script in power bi desktop.&lt;/P&gt;&lt;P&gt;Here is the script that i have used to get the twitter data.&lt;/P&gt;&lt;PRE&gt;library(twitteR)
source("authenticate.R")
tweets &amp;lt;- searchTwitter("Virat",n = 100,lang = "en")
tweetsdf &amp;lt;- twListToDF(tweets)&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Details: "Unable to translate bytes [ED][A0] at index 127 from specified code page to Unicode."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is running fine and am able to get the tweets in R studio, but not in Power Bi R script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please suggest me.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 09:07:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/130538#M4480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-21T09:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: R script Getting Error Unable to translate bytes</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/133222#M4593</link>
      <description>&lt;P&gt;Could you post the completed code? I did download the&amp;nbsp;twitteR and OATH package, however not yet to run your R script.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2017 07:36:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/133222#M4593</guid>
      <dc:creator>KumarDarmesh</dc:creator>
      <dc:date>2017-02-26T07:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: R script Getting Error Unable to translate bytes</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/138210#M4770</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/9157"&gt;@KumarDarmesh&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have solved this issue by using stringi package.&lt;/P&gt;&lt;P&gt;here is the script that i have used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;library(twitteR)&lt;BR /&gt;library(stringi)&lt;/P&gt;&lt;P&gt;tweets &amp;lt;- searchTwitter(search_term, number_of_tweets )&lt;BR /&gt;#convert received data to something PowerBi understands&lt;BR /&gt;df_tweets &amp;lt;- twListToDF(tweets)&lt;/P&gt;&lt;P&gt;#column clean&lt;BR /&gt;df_tweets$text &amp;lt;- stri_encode(df_tweets$text, "", "UTF-8")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It cleans the column which are not understandable.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 20:51:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/138210#M4770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-07T20:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: R script Getting Error Unable to translate bytes</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/778133#M20551</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the same R library to extract tweets in powerBI . My R script is working fine when the search_term is hardcoded. But when I am trying to create an invoked function to pass the search_term as a parameter it&amp;nbsp;gives the following error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;An error occurred in the ‘’ query. DataSource.Error: ADO.NET: R script error.
During startup - Warning message:
In setJsonDatabasePath(system.file("extdata/capabilities.json",  :
  bytecode version mismatch; using eval
Error: unexpected symbol in:
"rScriptWrapper_options = getOption('save.image.defaults')
save(list = rScriptWrapper_dataFrames, file = "globalEnv.rdata"
Execution halted

Details:
    DataSourceKind=R
    DataSourcePath=R
    Message=R script error.
During startup - Warning message:
In setJsonDatabasePath(system.file("extdata/capabilities.json",  :
  bytecode version mismatch; using eval
Error: unexpected symbol in:
"rScriptWrapper_options = getOption('save.image.defaults')
save(list = rScriptWrapper_dataFrames, file = "globalEnv.rdata"
Execution halted

    ErrorCode=-2147467259
    ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException&lt;/PRE&gt;&lt;P&gt;I am very new to PowerBI and hence trying a&amp;nbsp; lot to solve this issue. I really appreciate any suggestion regarding this. I am also attaching the R script for creating the invoked function.&lt;/P&gt;&lt;PRE&gt;(Name as text) as table=&amp;gt;
let
    
  Source = R.Execute(" #(lf)   library(twitteR)
                         #(lf)   library(stringi)
                         #(lf)   consumer_key &amp;lt;- ""8R96HfpMmwog1w4V0f6HrfwS9"" 
                         #(lf)   consumer_secret &amp;lt;- ""Smun1VSNdn30P5HfvAJ4AR8XSmqOevkGCvwQ2RJpXrHptRTEui""
                         #(lf)   access_token &amp;lt;- ""1306483171-2I5rsnK7AvYStXEja7lDu9AAI7ftuv6CvcbhhW0""
                         #(lf)   access_secret &amp;lt;- ""SlsagLzQfoaE0VzocM6ycFLqSk0PtImwekwENZt339yej""
                         #(lf)   setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
                       &lt;FONT color="#FF0000"&gt;  #(lf)   str1 &amp;lt;- ""#""
                         #(lf)   str2 &amp;lt;- ""&amp;amp;Name&amp;amp;""   &lt;FONT color="#0000FF"&gt;(passing parameter here)&lt;/FONT&gt;&lt;/FONT&gt;
                         #(lf)   search_term &amp;lt;- paste(str1,str2,sep="") 
                         #(lf)   number_of_tweets &amp;lt;- 100
                         #(lf)   language &amp;lt;-'en'
                         #(lf)   tweets &amp;lt;- searchTwitter(search_term, number_of_tweets,language)
                         #(lf)   df_tweets &amp;lt;- twListToDF(tweets)
                         #(lf)   df_tweets &amp;lt;- df_tweets[,c('text','favorited','favoriteCount','created','retweetCount',
                                                                                              'isRetweet','retweeted')]
                         #(lf)   df_tweets$text &amp;lt;- stri_encode(df_tweets$text, '', 'UTF-8')"),
    df_tweets1 = Source{[Name="df_tweets"]}[Value]
in
    df_tweets1&lt;/PRE&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 16:46:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/R-script-Getting-Error-Unable-to-translate-bytes/m-p/778133#M20551</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-28T16:46:48Z</dc:date>
    </item>
  </channel>
</rss>

