Skip to contents

Create App From Function and Inputs

Usage

appify(f, inps, out = "plot", id = NULL, theme = "bootstrap4")

Arguments

f

a function as a string

inps

a list of inputs, see ?inp_text, ?inp_number and ?inp_dropdown

out

the output type (currently the only valid value is "plot", with "table" planned for future releases)

id

html identifier, when NULL the id will be generated randomly. If you set the id manually, make sure it is unique.

theme

CSS framework to use. Currently only "bootstrap4" is supported.

Value

An object of class "appifyr_app" containing the HTML components that can be included in R Markdown documents or Shiny applications.

Examples

# Simple histogram function
# hist_fun <- function(n, bins) {
#   hist(rnorm(n), breaks = bins)
# }
# 
# Create app with numeric inputs
app <- appify(
  f = "hist_fun", 
  inps = list(
    n = inp_number(from = 10, to = 1000, label = "Sample Size"),
    bins = inp_number(from = 5, to = 30, label = "Number of Bins")
  )
)