plot - Embed in R markdown a googleVis chart generated using a function -


i have function creates same type of googlevis plot different data frames. these plots embedded in markdown file. embedding single plot result='asis' option fails achieve objective when chart object created function. following dummy code same:

embedded googlevis plots =====================  text here  ```{r} library(googlevis) op <- options(gvis.plot.tag="chart") ```  , plot  ```{r result='asis', tidy=true} mark_func <- function(data) {     data$mean=mean(data$popularity)     cc <- gviscombochart(data, xvar='city',           yvar=c('mean', 'popularity'),           options=list(seriestype='bars',                        width=450, height=300,                        title='city popularity',                        series='{0: {type:"line"}}'))     return(cc) } ```  ```{r result='asis', tidy=true} plt <- mark_func(citypopularity) plot(plt)` ```   

i converting markdown file html using knit2html knitr package , viewing html in firefox. instead of seeing plot, see long html code.

what missing? help.

it typos. forgetting escape quotemarks @ end , code chunk option should results, not result.

working code:

%\vignetteengine{knitr::knitr}  ```{r} library(googlevis) op <- options(gvis.plot.tag="chart") ```  ```{r results='asis', tidy=true} mark_func <- function(d) {     d$mean=mean(d$popularity)     cc <- gviscombochart(d, xvar='city',           yvar=c('mean', 'popularity'),           options=list(seriestype='bars',                        width=450, height=300,                        title='city popularity',                        series='{0: {type:\"line\"}}'))     return(cc) } ```  ```{r results='asis', tidy=true} plt <- mark_func(citypopularity) plot(plt) ```   

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -