user2676195 user2676195 - 1 month ago 14
R Question

How to force R Studio to use Viewer Pane for GoogleVis

Trying to use gvisTimeline from googleVis, but I'd like the plots to be shown in the Viewer Pane.

From what I can gauge from here (http://www.r-bloggers.com/display-googlevis-charts-within-rstudio/) it looks like the Viewer pane should be the default, but mine is showing up in the browser.

I did find this support article (https://support.rstudio.com/hc/en-us/articles/202133558-Extending-RStudio-with-the-Viewer-Pane) but am unclear how to apply it to my specific need of using gvisTimeline.

ex:

library(googleVis)
dat <- data.frame(Stn=device.positions$StationName,Idnt=device.positions$Ident,start=as.POSIXct(device.positions$Start),end=as.POSIXct(device.positions$End))
timeline <- gvisTimeline(data=dat, rowlabel="Stn", barlabel="Idnt", start="start", end="end")
plot(timeline)


where device.positions is a basic data table

Answer

When you plot the googleViz object you need to pass this as an option

plot(object, browser=rstudio::viewer)
Comments