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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.