0

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?

1 Answer 1

1

"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)
Sign up to request clarification or add additional context in comments.

2 Comments

Wow it works! But how can I refer to other dataframes? For example, I have more than 1 data set, and I would like to take data from there to create a specific table. Is it possible? thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.