Forum Discussion
R script with several dataframes
- 9 years ago
When using R scripts in Power BI Desktop, it will generate one dataset for each data frame. If you generate multiple data frames with single R script, it will generate multiple datasets and repeat the R script for each dataset. We can't access the original script and make changes applied to all datasets by updating only one script.
Also when refreshing dataset, it will run the R script again for each dataset which is very inefficient in your scenario. So I suggest you use multiple R scripts and each of them only creates one data frame.
Reference:
Running R Scripts in Power BI DesktopRegards,
When using R scripts in Power BI Desktop, it will generate one dataset for each data frame. If you generate multiple data frames with single R script, it will generate multiple datasets and repeat the R script for each dataset. We can't access the original script and make changes applied to all datasets by updating only one script.
Also when refreshing dataset, it will run the R script again for each dataset which is very inefficient in your scenario. So I suggest you use multiple R scripts and each of them only creates one data frame.
Reference:
Running R Scripts in Power BI Desktop
Regards,
I have the same issue... it isn't effiencient to create N number scripts for each data.frame as I'd have to reproduce the same logic and pull data from data sources multiple times...