Skip to contents

The studio guide for mascot_example(). The same page is read in the mascot studio.

Try it live. The mascot studio shows this function with live controls and the generated code. In an R session with the optional packages bslib and knitr installed, run:
mascot::mascot_studio(fn = "mascot_example")
It opens on this function's guide; change a control and watch the mascot.

Copy an example into your project

Find the names with mascot_examples() , then locate an app without starting a server:

basename(mascot::mascot_example("form-check", run = FALSE))

The call returns app.R. To adapt this single-file example, copy that file into your project:

path <- mascot::mascot_example("form-check", run = FALSE)
file.copy(path, "app.R", overwrite = FALSE)

Choose a destination without an existing app.R. For the multi-file examples ("studio", golem and the rhino-shaped one), copy the whole containing folder instead so that their supporting files stay together. The golem example needs golem; the single-file scenarios need Shiny, bslib and mascot (long-task also needs promises and later).

Run one

To explore all functions before adapting a single scenario, open the bundled app that shows every function, from an interactive R console:

mascot::mascot_example("studio")

Or run a copied example’s directory with shiny::runApp(). The call waits until the app closes; locating the file with run = FALSE does not launch it.

Warnings, errors and common mistakes

mascot_example("unknown-example", run = FALSE)
Error: could not find function "mascot_example"