I am trying to develop an R package that depends on Stan and I get an immediate problem if I use rstan_package_skeleton as described in “Step by Step Guide for creating a package that depends on Stan”. The problem seems to arise from the zzz.R file line:
modules <- paste0("stan_fit4", names(stanmodels), "_mod")
for (m in modules) loadModule(m, what = TRUE)
because when I run rstan_package_skeleton the output includes the error message: “Error in is(module, “character”) : object ‘m’ not found”.
Although the package appears nevertheless to have been created, I get the same error message when I use dev_tools::document(). If I simply delete the zzz.R file document() runs normally.
Yeah, I guess it doesn’t say you have to tolerate errors in the meantime, but typically someone should have a working Stan program before starting to write a R package around it.