Reputation: 149
I have seen similar problems to this one but I have not found a solution for this specific case.
Context: I have some excel files imported into Power BI and I need to do some analysis.
Goal:
I want to run the following code: head(my_df,3)
To achieve that I do the following: Home -> Transform Data -> Power Query Editor opens -> Click on "my_df" -> "Run R script" -> "output <- head(my_df,3)
This results in the following error message:
DataSource.Error: ADO.NET: R script error. Error in head(raw_booking, 3) : object 'raw_booking' not found Execution halted
Details: DataSourceKind=R DataSourcePath=R Message=R script error. Error in head(raw_booking, 3) : object 'raw_booking' not found Execution halted
I tried head(iris,3) and it worked!!! What am I missing?
Upvotes: 0
Views: 1881
Reputation: 26
"Run R script" takes the input data from the last applied step in the query and stores it as dataset
in the script window.
Therefore, try:
output <- head(dataset, 3)
Upvotes: 1