rmote Updates
This article is originally published at http://ryanhafen.com/
I recently announced the rmote package for serving various graphics from an interactive remote R session to a local machine. I have made a few noteworthy upates to the package, so here’s a quick post about them. The most major update is an enhanced plot history navigator in the viewer, which you can see in action below.
The current version is 0.3.4. To get the latest update, do
install.packages("rmote", repos = c(CRAN = "http://cran.rstudio.com",
tessera = "http://packages.tessera.io"))
or alternatively
devtools::install_github(c("yihui/servr", "hafen/rmote"))
History navigation
I have updated the rmote viewer to provide better navigation of the output history. This is best described by watching the screen capture below.
Adding this feature required several updates, including creating thumbnail methods for each output type and updating the viewer to have a collapsible history sidebar.
A couple of useful keyboard shortcuts to note for the viewer:
- up/down/left/right arrows navigate the history
- ‘h’ will show / hide the history sidebar
The viewer is compact, written in about 150 lines of html/css/javascript with no dependencies.
If you don’t want thumbnails and history navigation (beyond simple iteration through plots with prev/next), you can initialize your rmote server with history = FALSE
.
Base R graphics support
I have added support for base R graphics. This works a bit differently from the other graphics outputs because all of the other outputs are objects with a print method that is called once. Base R graphics, on the other hand, have a device instantiated at the first plot command, and then are built upon with subsequent plot commands. Because of this, rmote needs to know when you are done with your base R plot and want it served. To accomodate this, you can call plot_done()
to let rmote know that it is time to send the plot.
For example:
plot(1:10)
abline(0, 1)
plot_done()
See the screen capture above to see this in action.
One might argue that a new plot should be served after every indiviual base R plot command, which I think should technically be possible, but would be one more intrusion into R internals.
Note that you can turn on or off support for base graphics or other graphics types by setting the appropriate flag in the call to start_rmote()
(e.g. basegraphics = FALSE
).
Other updates
- Fixed an issue such that if you have your own graphics devices open, rmote will not interfere with them.
- Fixed an issue with the live reloading (thanks to Yihui Xie for accomodating this) so that the index reliably updates each time a new plot is made.
- The viewer web page now shows the name of the remote in the title (useful for multiple remotes) which can be turned off by setting
hostname = FALSE
instart_rmote()
.
Thanks for visiting r-craft.org
This article is originally published at http://ryanhafen.com/
Please visit source website for post related comments.