Forum Discussion

Tn_Gartn's avatar
Tn_Gartn
Frequent Visitor
7 years ago

Error in running an R script using sentimentr library in PowerBI

sentimentr_qvr <- read.csv("C:/data/CES.csv")

sentimentr_qvr_sentence <-get_sentences(sentimentr_qvr)
library(sentimentr)
library(lubridate)
library(ggplot2)
library(dplyr)
library(readr)
library(stringr)
library(tidytext)
library(dplyr)
library(sentimentr)
sentimentr_qvr_sentence <-get_sentences(sentimentr_qvr)
library(sentimentr)
average_sent_score <- sentiment_by(sentimentr_qvr_sentence, by = NULL)

 

Above code runs fine in R studio but its throwing error when i run through PowerBI. your help is very much appreciated!

Error Detail

8 Replies

    • Tn_Gartn's avatar
      Tn_Gartn
      Frequent Visitor

      Looks like sentimentr library/package is not supported by PowerBI at this time.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi dedelman_clng ,

       

      I am also trying to use "sentimentr" library in My powerBI dataset. But having the same "DataFormat.Error: ENVSXP" for the same script. My code also works fine in RStudio. I am very new to PowerBI. I really appreciate any suggestion regarding this.

      # 'dataset' holds the input data for this script
      #dataset has only one 'Text' column
      library(dplyr)
      library(sentimentr)
      
      
      df_final_tweets <- data.frame (
        Tweet_Text = c(dataset$Text),
        stringsAsFactors = FALSE
      )
      
      senti_text <- get_sentences(df_final_tweets)
      Sentiment = sentiment_by(senti_text,by = NULL)
      
      dataset_with_Sentiment_score <- data.frame (
        Tweet_TEXT = c(df_final_tweets$Tweet_Text),
        Senti_Score = round(Sentiment$ave_sentiment , 2 ),
        stringsAsFactors = FALSE
      )

      Note: According to the Most Recent PowerBI Documentation "sentimentr" package is supported by PowerBI at this time. 

       

      Thanks in advance.

       

      • dedelman_clng's avatar
        dedelman_clng
        Community Champion

        Please make sure you have the latest version of PowerBI and show us the entirety of the "R script editor" window that you are using.