Interactively Step Through the Construction of a Boxplot
ShinyBoxplotBuild.RdLaunches a Shiny app that steps through the process of building a
boxplot (box-and-whiskers plot). By default it uses the
precip dataset of average annual precipitation for U.S.
cities, but any numeric vector can be supplied.
Usage
ShinyBoxplotBuild(data = datasets::precip, xlab, step = 1)Arguments
- data
A numeric vector of data to build the boxplot from. Defaults to
datasets::precip.- xlab
Label for the x-axis. Defaults to
"precip"whendatais left at its default, or to a deparsed version of thedataargument otherwise.- step
Initial step number to display (1 to 13).
Details
This function requires the shiny package to be installed. The app has a single numeric input, “Step”, that controls how much of the construction is shown: setting up the axis, plotting the raw data, locating the median, the quartiles and the IQR (with the IQR and fence values shown in the step titles, computed from the supplied data), drawing the box, whiskers, and finally marking potential outliers.
Generally you will run the app with the default step of 1, then use the
increment button in the Step box to step through the process.
Possibly entering a number if you want to skip ahead or go back to a
specific step.
Value
Launches the app in non-blocking mode (via
startApp) and returns a ShinyAppHandle
immediately, so the R console remains available while the app runs
in the background. Use handle$stop() to stop the app.
Author
Greg Snow 538280@gmail.com
Examples
if(interactive()) {
h <- ShinyBoxplotBuild()
# h$stop() # run this when finished with the app
h <- ShinyBoxplotBuild(mtcars$wt, xlab='Car Weight')
# h$stop() # run this when finished with the app
}