異なるデータ フレームに対して同じタイプのgoogleVisプロットを作成する関数があります。これらのプロットは Markdown ファイルに埋め込まれます。オプションを使用して単一のプロットを埋め込むとresult='asis'、関数によってチャート オブジェクトが作成されたときに目的を達成できません。以下は、同じダミーコードです。
Embedded googleVis plots
=====================
Some text here
```{r}
library(googleVis)
op <- options(gvis.plot.tag="chart")
```
And now the 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)`
```
knit2htmlパッケージを使用してこの Markdown ファイルを HTML に変換し、knitrこの HTML を Firefox で表示しています。プロットではなく、長い HTML コードが表示されます。
私が見逃しているのは何ですか?ご協力いただきありがとうございます。