Skip to contents

Launches a Shiny app with a scatterplot of bivariate data and linked slider inputs for the correlation and R-squared, along with the number of observations and the random seed.

Usage

ShinyCorExamp2(n = 100, seed = 1, initial_cor = 0)

Arguments

n

Initial number of observations to plot.

seed

Initial random seed used to generate the data.

initial_cor

Initial value of the correlation slider.

Details

This function requires the shiny package to be installed. It is similar to ShinyCorExamp, but provides a slider for R-squared as well as correlation; moving either slider updates the other to match. New bivariate normal data are generated with the specified correlation and plotted as a scatterplot, with the correlation and R-squared shown in the plot title.

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 <- ShinyCorExamp2()
  # h$stop() # run this when finished with the app
}