How to load precomputed data
vasishth opened this issue · 2 comments
vasishth commented
Can I do this in a markup file? I.e., I store the precomputed Stan analysis results in the data directory (it takes a long time to compute).
if (file.exists("../../data/KB07_stan.Rda")) {
load("../../data/kb07_stan.rda")
} else {
run stan model:
kb07model <- stan("KB07model.stan",
data = dat,
chains = 0)
dmbates commented
I wouldn't use explicit paths like that. There is an R function to access the directory in which a package is installed but I have forgotten its name and can't seem to find it. I know it is Pkg.dir()
in Julia but that doesn't help here.
dmbates commented
The function I was thinking of is system.file()
with the optional package=
argument.