Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

R Script - change the dataframe at runtime



When creating an R Script visual these hints appear by default - 


"The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script
dataset <- data.frame(Category, Sales)  "
Does this dataset have to be used by the R Script, or is it possible to build your own dataset dynamically in the R Script,  based on a filter selection chosen by the user ?
Super User
Super User

@richard_wylde - I haven't found a way to do that although it has been a while since I tried. When I last ran into this it was in trying to create a word cloud so removing duplicate values sort of defeats the purpose. I ended up having to export my data to a file and then use the R script to read the data back in. Real pain and I was so disgusted with the process that I pretty much gave up on R visuals as mostly useless quite frankly. Whoever had the idea to remove duplicates by default should be taken into a back alley and given a severe beat down.

@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

Hi @Greg_Deckler  - not quite the answer I was hoping for but thanks for preventing me wasting any more time on this !

Helpful resources

June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors