Feature Request: Export operations performed on Data Viewer

I was thinking, perhaps it would be an easy win to provide an "EXPORT OPERATIONS" button to the Data Viewer, such that after a user has investigated quite some stuff, clicking the button would dump out into the console the code that one needs to recreate that view using code.

So for example, say I'm navigating iris in the Data Viewer... and I finally find that I'm happy after arranging by the Petal.Length, and filtering the Petal.Width and Species. It looks like this:

image

It would be cool if there would be some button that would output the code to generate that data.frame:

iris %>% arrange(Petal.Length) %>% filter(Petal.Width >= 2, Species == "virginica")

That way, our explorations in the Data Viewer could be an integral part of the EDA which would subsequently allow us to continue working on that reduced dataset.

What do you all think?

1 Like

Personally, I love features that help people capture the results of interactive exploration in code!

According to the Data Viewer documentation, the idea of saving filters as code is on the radar at the “we might do this in a future release” level. One of the RStudio Addin examples is an interactive data frame subsetter that produces code when you’re done — how does that compare to what you are envisioning? There’s also this existing feature request for data frame-related code generation from the Environment pane, but I think what you have in mind is a bit more comprehensive?

So if you decide you want to write this up as an official feature request, here’s how to do it: RStudio IDE Wiki: Writing Good Feature Requests

1 Like

Thanks @jcblum, it's almost exactly covered in the Data Viewer Documentation. I looked to see if anyone had asked in github and in this community but couldn't find any mention... that's why I asked. Searching is hard! :slight_smile:
But yes, the feature I want is exactly mentioned in the documentation as a "maybe future release".

1 Like