Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
# build dev site on merged pushes
push:
branches: [main, master]
# build full site on releases
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::., any::withr, stan-dev/pkgdown-config

- name: Build site
run: |
withr::with_envvar(
c("NOT_CRAN" = "true"), # this should already be set by setup-r@v2? keeping because vignettes don't build otherwise
pkgdown::build_site_github_pages(
lazy = FALSE, # change to TRUE if runner times out.
run_dont_run = TRUE,
new_process = TRUE
)
)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Suggests:
pkgload,
roxygen2 (>= 6.0.1),
rmarkdown,
rstudioapi
RoxygenNote: 7.3.2
rstudioapi,
devtools
RoxygenNote: 7.3.3
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
80 changes: 80 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
url: https://mc-stan.org/rstantools

destination: "."

template:
package: pkgdownconfig

navbar:
title: "rstantools"

structure:
left: [home, vignettes, functions, news, pkgs, stan]
right: [search, bluesky, forum, github, lightswitch]

components:
pkgs:
text: Other Packages
menu:
- text: bayesplot
href: https://mc-stan.org/bayesplot
- text: cmdstanr
href: https://mc-stan.org/cmdstanr
- text: loo
href: https://mc-stan.org/loo
- text: posterior
href: https://mc-stan.org/posterior
- text: projpred
href: https://mc-stan.org/projpred
- text: rstan
href: https://mc-stan.org/rstan
- text: rstanarm
href: https://mc-stan.org/rstanarm
- text: shinystan
href: https://mc-stan.org/shinystan

articles:
- title: "Recommendations for R package development with Stan"
desc: >
This vignette provides many recommendations for developers interested in
creating an R package that interface with Stan. Topics include
development best practices, precompiling Stan programs, R code and
documentation, and more.
contents:
- developer-guidelines
- title: "Step-by-step guide"
desc: >
This vignette walks through the steps required to set up a package with
a precompiled Stan model, from creating the initial package structure to
adding the precompiled Stan program and writing the R function that users
will call to fit the model.
contents:
- minimal-rstan-package

reference:
- title: "Package structure"
desc: >
Creating the basic structure of a Stan-based R package or add
Stan programs to an existing package.
contents:
- rstantools-package
- rstan_create_package
- use_rstan
- rstan_config
- rstantools_load_code
- title: "Generics"
desc: >
S3 generics (and some default methods) for adding functionality
to your package using the same naming conventions as **rstanarm**
and other Stan-based R packages.
contents:
- bayes_R2
- log_lik
- loo-prediction
- posterior_interval
- posterior_epred
- posterior_linpred
- posterior_predict
- predictive_error
- predictive_interval
- prior_summary
15 changes: 5 additions & 10 deletions vignettes/minimal-rstan-package.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ output:
params:
EVAL: !r identical(Sys.getenv("NOT_CRAN"), "true")
vignette: >
%\VignetteIndexEntry{Step by step guide}
%\VignetteIndexEntry{Step by step guide for creating a package that depends on RStan}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
Expand Down Expand Up @@ -235,16 +235,11 @@ 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. This can be done with the
function `devtools::document()`.

```{r, eval = FALSE}
try(roxygen2::roxygenize(load_code = rstantools_load_code), silent = TRUE)
roxygen2::roxygenize()
```
```{r, echo=FALSE, results="hide"}
try(roxygen2::roxygenize(PATH, load_code = rstantools_load_code), silent = TRUE)
roxygen2::roxygenize(PATH)
```{r}
devtools::document(PATH)
```

## Install and use
Expand Down
Loading