R Web & Reproducible Research Skill
Sub-skills
| Sub-skill |
Description |
| r-web-shiny |
Shiny apps, golem, shinyjs |
| r-web-api |
plumber, httr, REST APIs |
| r-web-scraping |
rvest, xml2, web scraping |
| r-web-reports |
rmarkdown, knitr, quarto |
Web technologies, APIs, and reproducible research in R.
Web Applications
| Package |
Description |
| shiny ★ |
Interactive web applications |
| shinyjs |
Improve Shiny UX |
| golem |
Production-grade Shiny framework |
| plumber ★ |
REST API from R functions |
| OpenCPU |
HTTP API for R |
HTTP & Web Scraping
| Package |
Description |
| httr ★ |
User-friendly HTTP client |
| httr2 |
Next-gen httr |
| curl |
Modern web client |
| RCurl |
General network client |
| rvest ★ |
Simple web scraping |
| xml2 |
XML parsing |
| XML |
XML tools |
Social Media APIs
| Package |
Description |
| Rfacebook |
Facebook API |
| rtweet |
Twitter API |
| RSiteCatalyst |
Adobe Analytics |
Reproducible Research
| Package |
Description |
| knitr ★ |
Dynamic report generation |
| rmarkdown ★ |
Dynamic documents |
| quarto ★ |
Next-gen publishing |
| bookdown |
Books with R Markdown |
| blogdown |
Websites with R Markdown |
| slidify |
HTML5 slides |
| xaringan |
Presentations (remark.js) |
Tables & Output
| Package |
Description |
| kableExtra |
Fancy HTML/LaTeX tables |
| gt |
Grammar of tables |
| flextable |
Tables for Word/PowerPoint/HTML |
| xtable |
Export to LaTeX/HTML |
| texreg |
Format models for LaTeX/HTML |
| formattable |
Formattable data structures |
Office Documents
| Package |
Description |
| officer |
Word/PowerPoint/HTML reports |
| openxlsx |
Excel files |
| writexl |
Write Excel |
Workflow & Reproducibility
| Package |
Description |
| targets ★ |
Make-like pipeline tool |
| checkpoint |
Package snapshots |
| renv |
Project environments |
| tinytex |
Lightweight LaTeX |
| brew |
Report templating |
Quick Examples
# Shiny app
library(shiny)
ui <- fluidPage(
titlePanel("App"),
sidebarLayout(
sidebarPanel(
sliderInput("n", "N:", 1, 100, 50)
),
mainPanel(
plotOutput("plot")
)
)
)
server <- function(input, output) {
output$plot <- renderPlot({
hist(rnorm(input$n))
})
}
shinyApp(ui, server)
# REST API with plumber
# plumber.R
#* @get /mean
function(n = 10) {
mean(rnorm(as.numeric(n)))
}
# Run: plumber::plumb("plumber.R")$run(port = 8000)
# Web scraping
library(rvest)
page <- read_html("https://example.com")
page %>%
html_elements("table") %>%
html_table()
# HTTP requests
library(httr)
resp <- GET("https://api.example.com/data",
query = list(key = "value"))
content(resp, "parsed")
# R Markdown document
---
title: "Report"
output: html_document
---
```{r}
summary(mtcars)
knitr tables
library(knitr)
kable(head(df), format = "html")
targets pipeline
library(targets)
_targets.R
list(
tar_target(data, read_csv("data.csv")),
tar_target(model, lm(y ~ x, data = data)),
tar_target(report, rmarkdown::render("report.Rmd"))
)
## Resources
- Shiny: https://shiny.rstudio.com/
- plumber: https://www.rplumber.io/
- R Markdown: https://rmarkdown.rstudio.com/
- Quarto: https://quarto.org/
- targets: https://docs.ropensci.org/targets/
1---2name: r-web3description: R web technologies and reproducible research. Use for Shiny apps, web scraping, REST APIs, dynamic reports (rmarkdown, knitr), and document generation.4metadata:5 source: https://skillmd.com/skills/leolin990405/r-web6---78# R Web & Reproducible Research Skill910## Sub-skills1112| Sub-skill | Description |13|-----------|-------------|14| [r-web-shiny](r-web-shiny/SKILL.md) | Shiny apps, golem, shinyjs |15| [r-web-api](r-web-api/SKILL.md) | plumber, httr, REST APIs |16| [r-web-scraping](r-web-scraping/SKILL.md) | rvest, xml2, web scraping |17| [r-web-reports](r-web-reports/SKILL.md) | rmarkdown, knitr, quarto |1819Web technologies, APIs, and reproducible research in R.2021## Web Applications2223| Package | Description |24|---------|-------------|25| **shiny** ★ | Interactive web applications |26| **shinyjs** | Improve Shiny UX |27| **golem** | Production-grade Shiny framework |28| **plumber** ★ | REST API from R functions |29| **OpenCPU** | HTTP API for R |3031## HTTP & Web Scraping3233| Package | Description |34|---------|-------------|35| **httr** ★ | User-friendly HTTP client |36| **httr2** | Next-gen httr |37| **curl** | Modern web client |38| **RCurl** | General network client |39| **rvest** ★ | Simple web scraping |40| **xml2** | XML parsing |41| **XML** | XML tools |4243## Social Media APIs4445| Package | Description |46|---------|-------------|47| **Rfacebook** | Facebook API |48| **rtweet** | Twitter API |49| **RSiteCatalyst** | Adobe Analytics |5051## Reproducible Research5253| Package | Description |54|---------|-------------|55| **knitr** ★ | Dynamic report generation |56| **rmarkdown** ★ | Dynamic documents |57| **quarto** ★ | Next-gen publishing |58| **bookdown** | Books with R Markdown |59| **blogdown** | Websites with R Markdown |60| **slidify** | HTML5 slides |61| **xaringan** | Presentations (remark.js) |6263## Tables & Output6465| Package | Description |66|---------|-------------|67| **kableExtra** | Fancy HTML/LaTeX tables |68| **gt** | Grammar of tables |69| **flextable** | Tables for Word/PowerPoint/HTML |70| **xtable** | Export to LaTeX/HTML |71| **texreg** | Format models for LaTeX/HTML |72| **formattable** | Formattable data structures |7374## Office Documents7576| Package | Description |77|---------|-------------|78| **officer** | Word/PowerPoint/HTML reports |79| **openxlsx** | Excel files |80| **writexl** | Write Excel |8182## Workflow & Reproducibility8384| Package | Description |85|---------|-------------|86| **targets** ★ | Make-like pipeline tool |87| **checkpoint** | Package snapshots |88| **renv** | Project environments |89| **tinytex** | Lightweight LaTeX |90| **brew** | Report templating |9192## Quick Examples9394```r95# Shiny app96library(shiny)97ui <- fluidPage(98 titlePanel("App"),99 sidebarLayout(100 sidebarPanel(101 sliderInput("n", "N:", 1, 100, 50)102 ),103 mainPanel(104 plotOutput("plot")105 )106 )107)108server <- function(input, output) {109 output$plot <- renderPlot({110 hist(rnorm(input$n))111 })112}113shinyApp(ui, server)114115# REST API with plumber116# plumber.R117#* @get /mean118function(n = 10) {119 mean(rnorm(as.numeric(n)))120}121# Run: plumber::plumb("plumber.R")$run(port = 8000)122123# Web scraping124library(rvest)125page <- read_html("https://example.com")126page %>%127 html_elements("table") %>%128 html_table()129130# HTTP requests131library(httr)132resp <- GET("https://api.example.com/data",133 query = list(key = "value"))134content(resp, "parsed")135136# R Markdown document137---138title: "Report"139output: html_document140---141```{r}142summary(mtcars)143```144145# knitr tables146library(knitr)147kable(head(df), format = "html")148149# targets pipeline150library(targets)151# _targets.R152list(153 tar_target(data, read_csv("data.csv")),154 tar_target(model, lm(y ~ x, data = data)),155 tar_target(report, rmarkdown::render("report.Rmd"))156)157```158159## Resources160161- Shiny: https://shiny.rstudio.com/162- plumber: https://www.rplumber.io/163- R Markdown: https://rmarkdown.rstudio.com/164- Quarto: https://quarto.org/165- targets: https://docs.ropensci.org/targets/