-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompileStan.R
More file actions
30 lines (26 loc) · 775 Bytes
/
compileStan.R
File metadata and controls
30 lines (26 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
suppressPackageStartupMessages({
library(vadr)
library(plyr)
library(rstan)
library(R.cache)
source("library.R")
})
set_cppo('fast')
infile <- "SlopeModel.stan.R"
outfile <- "SlopeModel.stan.RData"
main <- function(infile, outfile) {
local({
base::source("stanFunctions.R", local=TRUE)
base::source(infile, local=TRUE)
hash <- list("stan_model",
model_name=strip_extension(infile),
model_code=model_code,
stan_version=packageVersion("rstan"))
((model <- loadCache(hash)) %||%
ammoc(model <- stan_model(model_name=strip_extension(infile),
model_code=model_code),
saveCache(model, hash)))
save(file=outfile, list=ls())
})
}
run_as_command()