https://github.com/parmsam/reprex.webr
Small R package inspired by reprex that generates a webR REPL URL based on copied R code or R code passed as the argument
https://github.com/parmsam/reprex.webr
Last synced: about 1 month ago
JSON representation
Small R package inspired by reprex that generates a webR REPL URL based on copied R code or R code passed as the argument
- Host: GitHub
- URL: https://github.com/parmsam/reprex.webr
- Owner: parmsam
- License: other
- Created: 2025-09-16T02:16:35.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-16T03:44:14.000Z (10 months ago)
- Last Synced: 2025-09-16T04:20:55.217Z (10 months ago)
- Language: R
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reprex.webr
An R package that provides `reprex_webr()`/`reprex_shinylive()` functions to generate WebR or SHinylive reproducible examples, inspired by the [reprex](https://reprex.tidyverse.org/) package.
## Installation
You can install the development version of reprex.webr from GitHub:
```r
# install.packages("devtools")
devtools::install_github("parmsam/reprex_webr")
```
## Usage
```r
library(reprex.webr)
library(clipr)
# Generate WebR URL from clipboard
write_clip("1 + 5")
reprex_webr()
# Generate WebR URL from code
reprex_webr(input = "1 + 1")
# Multiple lines of code
reprex_webr(input = c(
"x <- 1:10",
"mean(x)",
"plot(x)"
))
# Pass an expression directly
reprex_webr({
x <- 1:10
mean(x)
plot(x)
})
# Generate shinylive.io URL from Shiny app code (NEW)
reprex_shinylive({
library(shiny)
ui <- fluidPage("Hello, world!")
server <- function(input, output, session) {}
shinyApp(ui, server)
})
# Or from a character vector
reprex_shinylive(input = c(
"library(shiny)",
"ui <- fluidPage('Hello, world!')",
"server <- function(input, output, session) {}",
"shinyApp(ui, server)"
))
```
## Features
- Generate shareable WebR URLs from R code
- Generate shareable shinylive.io URLs from Shiny app code (NEW)
- Read code from clipboard (requires `clipr` package)
- Accepts code as an expression, character vector, file path, or clipboard
- Similar API to the `reprex` package