目录

R build
status CRAN
status Lifecycle:
experimental

htmltools

Tools for creating, manipulating, and writing HTML from R.

Installation

Install the stable release of htmltools on CRAN:

install.packages("htmltools")

Install the development version with:

remotes::install_github("rstudio/htmltools")

Quick overview

{htmltools} makes it easy to customize the user interface (UI) of any Shiny or R Markdown project by using R code to generate custom HTML (including JavaScript and CSS).

This Shiny article provides a great introduction to {htmltools} (even if you’re not interested in Shiny). As you’ll learn in that article, the general foundation that {htmltools} provides allows other R packages (e.g., {htmlwidgets}, {crosstalk}, etc.) to provide “HTML components” in R that users can manipulate and combine in ways the component authors didn’t foresee.

For example, as described in depth here, {htmltools} makes it fairly easy to arrange numerous {htmlwidgets} (e.g., {plotly} graphs) into a single static HTML webpage:

library(htmltools)
library(plotly)
browsable(tagList(
  plot_ly(diamonds, x = ~carat, height = 200),
  plot_ly(diamonds, x = ~price, height = 200)
))

Also, thanks to tagQuery(), it is fairly easy to query and manipulate the underlying HTML structure of components. See the tagQuery() article to learn more.

Learn more

If you’re looking to learn how to build more custom user interfaces by writing custom HTML/JavaScript/CSS, we recommend the following resource:

关于

用于在R语言中生成和处理HTML内容的工具包

3.8 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号