Hello to the Stan R community!
This post is to announce that we will be deprecating our custom R-packages repo ("https://mc-stan.org/r-packages/"
) and instead using R-Universe for building and distributing our R packages.
This allows us to take advantage of R-Universe’s fantastic infrastructure for automatically building R package binaries for a range of platforms (including WASM! - but not always, see the ps below). This means that all of our packages now provide binaries for Windows and MacOS (Intel & Apple Silicon).
You can follow the same process for installing packages, all that is changing is the repo URL.
Not all of our packages in the repository are directly building off the develop
branch of the respective Github repo, so I’ve summarised the configurations below.
Let me know if you run into any issues!
Package Configurations
rstan
& StanHeaders
rstan
and StanHeaders
are built from the experimental
branch, which follows the current release schedule (Stan v2.35):
install.packages("rstan", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
rstanarm
rstanarm
is built from the feature/survival
branch (which provides stan_surv
), and is compiled against the experimental
branch of rstan
above:
install.packages("rstanarm", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
cmdstanr
Unlike the other R packages, the cmdstanr
package is only updated/built for release versions (currently 0.8.0
), it does not automatically update on changes to the Github repository:
install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
All Others
All of our other R packages are automatically updated/rebuilt on any changes to their respective development repositories:
rstantools
install.packages("rstantools", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
loo
install.packages("loo", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
posterior
install.packages("posterior", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
projpred
install.packages("projpred", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
bayesplot
install.packages("bayesplot", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
posteriordb
install.packages("posteriordb", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
shinystan
install.packages("shinystan", repos = c("https://stan-dev.r-universe.dev",
"https://cloud.r-project.org"))
rstan
packages and WASM
R packages which distribute Stan models cannot currently be built for WASM/webR as the version of the TBB used by RcppParallel
does not support building for WASM. However, I’m currently working on updating the WASM build dependencies to support the TBB, so you’ll soon be able to run your favourite Stan package in the browser!
(Note that you won’t be able to use rstan
itself to compile models in WASM, as webR does not support compiling code in the browser)