demoShiny

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

The aim of the package demoShiny is to mimic the demo functionality for Shiny apps for a package.

Which Shiny apps are available?

With demoShiny you can get an overview about all apps from the loaded packages:

library("demoShiny")
demoShiny()

The output is a data frame with package::topic and the file or directory which would be called by demoShiny.

You can question for specific apps:

demoShiny('demoShiny')

It will deliver all demo apps of the package demoShiny AND all apps named demoShiny!

How to run a single example app?

In case that for your topic is just one app available then no list will be returned but the Shiny demo app will be started:

# full topic
demoShiny('demoShiny::hist')
# if only one app is available then it will be run
demoShiny('hist')
# abbreviation for topics or packages can used
demoShiny('d::hist')

App installation for a package in inst/shiny

If you develop a package then create under inst a directory shiny. Each subdirectory of shiny can contain one app. The name of the subdirectory is the topic name.

list.files(system.file('shiny', package="demoShiny"), include.dirs=TRUE)

As you can see the shiny subdirectory of demoShiny contains several directories, e.g. app1, silhouette, and also a file app1.R.

If you put an R file with the same name as a directory then the R file is sourced instead of calling the app in the directory. The aim is to allow for a specific calls to the app, e.g. by setting URL parameters:




Try the demoShiny package in your browser

Any scripts or data that you put into this service are public.

demoShiny documentation built on March 26, 2020, 7:34 p.m.