Did you remember to add LazyData: true
to the file DESCRIPTION
, as recommended in Karl's article? If yes, you should be able to load your package at the top of your Shiny script, and the data reg
will be available for use.
As an example, I used RStudio to create a new Shiny project (File->New Project->New Directory->Shiny Web Application). This creates a small example to create a histogram from the data set faithful
in the package datasets
. Here is the relevant snippet:
x <- grav$pheno$T0
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
To demonstrate how to use this with a non-built in R package, I used Karl's R/qtlcharts package. I loaded the package at the top of the script:
library(shiny)
library(qtlcharts)
And I changed the data set from faithful
to grav
:
x <- grav$pheno$T0
Because Karl set LazyData: true
, this worked. Similarly, if you configured your package the same as Karl recommends, you should be able to load your package and then refer specifically to the reg
data set in the Shiny code.
If that isn't working for you, could you please share the error message and/or a reproducible example?