How to export two HTML widgets in the same HTML page in R? -
we intend create html page using r
contains 2 (or more) widgets. 1 widget holds timeline , other holds data table dataframe.
we able create 2 separate html pages follows:
library(timevis) library(htmlwidgets) data <- data.frame( id = 1:4, content = c("item one", "item two", "ranged item", "item four"), start = c("2016-01-10", "2016-01-11", "2016-01-20", "2016-02-14 15:00:00"), end = c(na, na, "2016-02-04", na) ) timevis(data) htmlwidgets::savewidget(timevis(data), "timeline.html", selfcontained = f)
the other widget data table follows:
acs <- read.csv(url("http://stat511.cwick.co.nz/homeworks/acs_or.csv")) acs_temp <- datatable(acs, options = list(pagelength = 10)) htmlwidgets::savewidget(acs_temp, "page2.html", selfcontained = f)
this saves 2 separate webpages hold timeline visualization , html data table. write r script in such way insert both table , timeline visualization on same html page. how can this?
use r markdown create html pages multiple exhibits/widgets:
--- title: "untitled" output: html_document --- ```{r setup, include=false} knitr::opts_chunk$set(echo = true) library(timevis) library(dt) data <- data.frame( id = 1:4, content = c("item one", "item two", "ranged item", "item four"), start = c("2016-01-10", "2016-01-11", "2016-01-20", "2016-02-14 15:00:00"), end = c(na, na, "2016-02-04", na) ) acs <- read.csv(url("http://stat511.cwick.co.nz/homeworks/acs_or.csv")) acs_temp <- dt::datatable(acs, options = list(pagelength = 10)) ``` ## r markdown ```{r timeviz} timevis(data) acs_temp ```
Comments
Post a Comment