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

R error

The following error appears when running R script in powerbi but not in RStudio, please help.

My R version is 3.3.1

 

DataSource.Error: ADO.NET: R script error.

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

filter, lag

The following objects are masked from 'package:base':

intersect, setdiff, setequal, union

Error in check_input(x) :
Input must be a character vector of any length or a list of character
vectors, each of which has a length of 1.
Calls: %>% ... unnest_tokens -> unnest_tokens_ -> tokenfunc -> tf -> check_input
Execution halted

Details:
DataSourceKind=R
DataSourcePath=R
Message=R script error.

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

filter, lag

The following objects are masked from 'package:base':

intersect, setdiff, setequal, union

Error in check_input(x) :
Input must be a character vector of any length or a list of character
vectors, each of which has a length of 1.
Calls: %>% ... unnest_tokens -> unnest_tokens_ -> tokenfunc -> tf -> check_input
Execution halted

ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Radio.RScriptRuntimeException

8 REPLIES 8
Anonymous
Not applicable

Did you ever find a solution? Having same issue...

Anonymous
Not applicable

yeah - for some reason, PowerBi takes character column as factor rather than character so I need to cast the column to as.character(dataset$column1) then it worked.

 

You may need to transform the column and apply Clean so it gets rid of whitespace etc...

 

Let me know if that works for you.

ankitpatira
Community Champion
Community Champion

@Anonymous Have you got the package you're using in your script intalled. If the package is installed then you need to load that package in your script ie use library(packagename) at start of the script.

Greg_Deckler
Super User
Super User

Any chance you can share some sample data and your R script so that we can try to replicate?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi there
Yep the data was a tweet dataset.
And yep I have the packages installed and loaded in r script

I copied and pasted the script in rstudio and it worked fine.

I got a feeling like it's tidytext package clashes with split. I'm no expert in R.

Thank you so much
Anonymous
Not applicable

I think the problem is this bit below Im not sure why tho.

 

Error in check_input(x) :
Input must be a character vector of any length or a list of character
vectors, each of which has a length of 1.
Calls: %>% ... unnest_tokens -> unnest_tokens_ -> tokenfunc -> tf -> check_input

 

ADDITIONAL INFO

Tried the same script as data source and it works perfectly! Just not as a Transform step within the query 😞

Hi Pedzila,

 

What is your current situation?

Could you please share about the R scripts that you used here?

We will try to reproduce the error and see if we could find any helpful information with the scripts.

I suspect it would work as the data source and not a transform step, should be caused by some functions used in the R scripts.

Regards

 

Anonymous
Not applicable

Hi

THanks for replying

R script below

 

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

title_words <- dataset %>%
select(text) %>%
unnest_tokens(Word, text)

 

Data (one column called text)

 

text

#AttributeOwnership is exactly why @apple will always be #one! #apple #marketing #marketer #business #innovation #fb

Can't wait to get my #Iphone5S!!! @apple

Swapped my #galaxys2 for an #iPhone4S. After one day I'd say I'm an @apple convert!

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.