Help page examples

I'd like to see a button on the help pane, or a keyboard shortcut, to run the examples for the active help page. That is the more important and easily implemented part.

I'd like it even better if the results appeared at the bottom of the help page, or in a new window, rather than in the console.

1 Like

I agree that would be a convenience over cut-and-paste; however, the hard part is still going to be understanding the output and which parts of the input got you there, sadly. Inevitable part of a functional language with many possible arguments, not all of which are necessarily familiar.

You might be interested in, which allows examples to be run (and modified) in a cloud session very quickly :slightly_smiling_face:


In newer versions of RStudio (i think v 1.1.x and higher - although not entirely sure the first version it appeared) you are able to run the code in help files by highlighting it and then using the keyboard shortcut Ctrl + Enter


It was a 1.1 feature! :smile: Here's the blog post:

@andrewH, I'm curious about this bit — do you just find it visually disruptive to have examples run in the console? Or do you mean that you'd prefer that they run in a completely independent R session?

For the latter (running an example without messing with my current environment/session), the reprex package and especially its Add-in can be helpful.


  • You have to copy the example to a new script file and add the right library() statements
  • You still get reprex::reprex() output in the console


  • Stuff created by the example stays out of your workspace/session
  • Example code and results all appear together in the RStudio Viewer pane

Also wanted to point out this collection of ideas from the github issue tracker:


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.