Reputation: 726
I have a following chart:
library(googleVis)
df = data.frame(models = c("PLAT", "LC", "APC", "CBD", "M6", "M7", "M8"), val = 1:7)
Column <- gvisColumnChart(df)
plot(Column)
I would like to place it in ioslides in RStudio. Can anyone instruct me how to do it?
Upvotes: 2
Views: 212
Reputation: 131
The key is to use options(gvis.plot.tag='chart')
as part of your code, this instructs the plot()
function to only output the html code for the chart. Here is the code:
## Another GoogleVis Slide
Some text in slide
```{r warning=FALSE, message=FALSE, results='asis', tidy=FALSE}
library(googleVis)
op <- options(gvis.plot.tag = 'chart')
df = data.frame(models = c("PLAT", "LC", "APC", "CBD", "M6", "M7", "M8"), val = 1:7)
Column <- gvisColumnChart(df)
plot(Column)
```
You can find this by typing ?plot.gvis
but I think it is not evident, so hopefully someone will save some time by reading this answer
Upvotes: 1