Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ Suggests:
roxygen2 (>= 6.0.1),
rmarkdown,
rstudioapi
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
2 changes: 1 addition & 1 deletion R/rstan_create_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @aliases rstan_package_skeleton
#'
#' @description
#' \if{html}{\figure{stanlogo.png}{options: width="25" alt="https://mc-stan.org/about/logo/"}}
#' \if{html}{\figure{logo.svg}{options: width="25" alt="https://mc-stan.org/about/logo/"}}
#' The `rstan_create_package()` function helps get you started developing a
#' new \R package that interfaces with Stan via the \pkg{rstan} package. First
#' the basic package structure is set up via [usethis::create_package()].
Expand Down
2 changes: 1 addition & 1 deletion R/rstantools-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @description
#' \if{html}{
#' \figure{stanlogo.png}{options: width="50" alt="mc-stan.org"}
#' \figure{logo.svg}{options: width="50" alt="mc-stan.org"}
#' } *Stan Development Team*
#'
#' The \pkg{rstantools} package provides various tools for developers of \R
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rstantools <img src="man/figures/stanlogo.png" align="right" width="120" />
# rstantools <img src="man/figures/logo.svg" align="right" width="120" />

<!-- badges: start -->
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/rstantools?color=blue)](https://cran.r-project.org/web/packages/rstantools)
Expand Down
83 changes: 83 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
url: https://mc-stan.org/rstantools

destination: "."

template:
package: pkgdownconfig

development:
mode: auto

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
97 changes: 1 addition & 96 deletions man/figures/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed man/figures/stanlogo.png
Binary file not shown.
2 changes: 1 addition & 1 deletion man/rstan_create_package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/rstantools-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 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,13 +235,14 @@ 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
available to users when the package is installed. This can be done with the
function `roxygen2::roxygenize()`, which needs to be called twice initially.

```{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)
Expand Down
Loading