Building R Package with Stan - error compiling

I’m trying to build an R package that uses Stan.

I ran this code to get the package skeleton:

library(rstantools)
rstan_package_skeleton(name = "StanTest", list = c('x'),
         environment = .GlobalEnv, path = ".", force = FALSE,
         code_files = character(), stan_files = c('logistic.stan','spline.stan'))

Just to check I’m on the right track I run the load_all function from devtools. I receive the following error that I cannot figure out:

> load_all()
Loading StanTest
Error in is(module, "character") : object 'm' not found

At a minimum, you need to call load_all with recompile = TRUE. I go outside RStudio entirely, in which case you need to do

R CMD INSTALL --preclean <X>

or

R CMD build <X>
R CMD INSTALL <X>.tar.gz
1 Like

That worked. Thanks!