cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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

@JNahar ,

 

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
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Kudoed Authors