1
対話プロットを使ってknitr::spin
を使ってrスクリプトからRmarkdownファイルを生成したいとします。それが生成するプロットは静的で、図のサブフォルダに配置されています。どのようにしてインタラクティブなプロットを生成することができますか?ここ対話プロットを使ってRスクリプトをhtmlファイルに変換するknitr :: spinの使い方
は一例です:
#' ---
#' title: "test me"
#' output:
#' html_notebook:
#' code_folding: hide
#' toc: true
#' toc_float: true
#' collapsed: false
#' ---
#+ warning=FALSE, echo=FALSE, message=FALSE
library(ggplot2)
library(plotly)
library(DT)
#' ## interactive cars
data(cars)
ggplotly(ggplot(data=cars,aes(x=speed,y=dist))+geom_point())
#' ## interactive table
datatable(cars)