diff --git a/DESCRIPTION b/DESCRIPTION index af1d142..823dc5f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,14 +48,16 @@ SystemRequirements: pandoc Imports: desc, stats, utils, Rcpp (>= 0.12.16), RcppParallel (>= 5.0.1) Suggests: rstan (>= 2.17.2), + BH (>= 1.66.0), + RcppEigen (>= 0.3.3.3.0), usethis (>= 1.5.1), testthat (>= 2.0.0), knitr, pkgbuild, pkgload, - roxygen2 (>= 6.0.1), + roxygen2 (>= 7.0.0), rmarkdown, rstudioapi -RoxygenNote: 7.3.3 VignetteBuilder: knitr Roxygen: list(markdown = TRUE) +Config/roxygen2/version: 8.0.0 diff --git a/man/rstantools-package.Rd b/man/rstantools-package.Rd index 327d82d..277fe3b 100644 --- a/man/rstantools-package.Rd +++ b/man/rstantools-package.Rd @@ -44,6 +44,7 @@ Useful links: Authors: \itemize{ + \item Jonah Gabry \email{jgabry@gmail.com} \item Ben Goodrich \email{benjamin.goodrich@columbia.edu} \item Martin Lysy \email{mlysy@uwaterloo.ca} \item Andrew Johnson @@ -54,6 +55,7 @@ Other contributors: \item Hamada S. Badr [contributor] \item Marco Colombo [contributor] \item Stefan Siegert [contributor] + \item Visruth Srimath Kandali [contributor] \item Trustees of Columbia University [copyright holder] } diff --git a/vignettes/minimal-rstan-package.Rmd b/vignettes/minimal-rstan-package.Rmd index e0fa99e..de7bc4a 100644 --- a/vignettes/minimal-rstan-package.Rmd +++ b/vignettes/minimal-rstan-package.Rmd @@ -157,7 +157,6 @@ model { } " writeLines(stan_prog, con = file.path(PATH, "inst", "stan", "lm.stan")) -rstan_config(PATH) ``` The `inst/stan` subdirectory can contain additional Stan programs if @@ -179,7 +178,7 @@ the package functions. The following comment block placed in `lm_stan.R` ensures that the function has a help file and that it is added to the package `NAMESPACE`: -```{r} +```{r, eval=FALSE} # Save this file as `R/lm_stan.R` #' Bayesian linear regression with Stan @@ -235,17 +234,18 @@ information about the package. With __roxygen__ documentation enabled, we need to generate the documentation for `lm_stan` and update the `NAMESPACE` so the function is exported, i.e., -available to users when the package is installed. This can be done with the -function `roxygen2::roxygenize()`, which needs to be called twice initially. +available to users when the package is installed. Load the R source files +directly when running `roxygen2::roxygenize()`, then call `rstan_config()` to +generate the Stan C++ code: ```{r, eval = FALSE} -try(roxygen2::roxygenize(load_code = rstantools_load_code), silent = TRUE) -roxygen2::roxygenize() +roxygen2::roxygenize(load_code = roxygen2::load_source) +rstantools::rstan_config() ``` ```{r, echo=FALSE, results="hide"} -try(roxygen2::roxygenize(PATH, load_code = rstantools_load_code), silent = TRUE) -roxygen2::roxygenize(PATH) +roxygen2::roxygenize(PATH, load_code = roxygen2::load_source) +rstan_config(PATH) ``` ## Install and use @@ -268,11 +268,8 @@ documentation, you can set `quick=TRUE` to speed up the process, or use After installation, the package can be loaded and used like any other R package: -```{r, eval=FALSE} -library("rstanlm") -``` - ```{r} +library(rstanlm) fit <- lm_stan(y = rnorm(10), x = rnorm(10), # arguments passed to sampling iter = 2000, refresh = 500)