Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Rscrpit doesn't work in PowerBI for 'sentimentr' Package

I am using "sentimentr" library to get the sentiment score of my dataset. The script works perfectly in R Studio. But throw an error when adding as an R script in Power BI.  

Capture.JPG

 

There is one post about using sentimentr library. https://community.powerbi.com/t5/Desktop/Error-in-running-an-R-script-using-sentimentr-library-in-Po... but back then the library was not supported by powerBI. According to most recent documentation sentimentr library is supported in powerBI now.  I am trying to figure out a way of working the script for the last couple of days. This is really very important to me right now. 

# 'dataset' holds the input data for this script
library(sentimentr)


dataframe_tweets <- data.frame (
  Tweet_Text = c(dataset$Text),
  stringsAsFactors = FALSE
)

base_text <- c(dataframe_tweets$Tweet_Text)

senti_text <- sentimentr::get_sentences(base_text)
Sentiment = sentiment(senti_text, by = NULL)

dataset_with_Sentiment_score <- data.frame (
  Tweet_TEXT = c(dataframe_tweets$Tweet_Text),
  Senti_Score = round(Sentiment$ave_sentiment , 2 ),
  stringsAsFactors = FALSE
)

But couldn't find a way till now. I would really appreciate if any kind-hearted people do take a look at my script and suggest to me what I might be doing wrong in my script.  

Thanks in advance. 

 

 

 

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

I can reproduce your issue but am not available to solve it. But I guess this issue should be related with the data format of 

c(dataset$Text)

 

If you still can't solve it, I would suggest you create a support ticket here.

 

Regards,

Jimmy Tao 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.