Turn your R functions into interactive web applications with minimal code!
appifyr bridges the gap between R's analytical capabilities and web interfaces by:
- Taking regular R functions
- Automatically generating HTML forms for function parameters
- Connecting these inputs to OpenCPU API calls
- Displaying the function outputs (currently plots)
# Install the package
install.packages("remotes")
remotes::install_github("retowyss/appifyr")
# Create a simple function
histogram_app <- function(n, bins) {
hist(rnorm(n), breaks = bins, main = "Random Normal Distribution")
}
# Create a web interface for your function
library(appifyr)
app <- appify(
f = "histogram_app",
inps = list(
n = inp_number(from = 10, to = 1000, label = "Sample Size"),
bins = inp_number(from = 5, to = 30, label = "Number of Bins")
)
)
# To run the app, you'll need OpenCPU
# install.packages("opencpu")
# opencpu::ocpu_start_app("YourPackageName")appifyr uses OpenCPU as a backend to create web interfaces for R functions. Unlike Shiny, which requires learning Shiny-specific syntax, appifyr works with regular R functions and requires minimal JavaScript/HTML knowledge.
- Shiny: You start with the goal of creating a specific app and write R code to achieve that goal.
- appifyr: You start with existing R code and create an app to visualize your function.
To run apps created with appifyr, you need OpenCPU:
# Install OpenCPU
install.packages("opencpu")
# Clone the demo application
# git clone https://github.com/retowyss/sepals-and-petals.git
# Build and start the app
appifyr::build_app()
opencpu::ocpu_start_app("SepalsAndPetals")- Simple API: The main function
appify()takes an R function and specifications for inputs - Intuitive Input Creation: Helper functions like
inp_text(),inp_number(), andinp_dropdown() - Built-in Web Components: Generates Bootstrap-styled form elements and layout
- Integration with OpenCPU: Uses the OpenCPU JavaScript library to handle API calls
- R ≥ 4.1.0
- OpenCPU for running the apps