Skip to content

Commit b5ad462

Browse files
authored
Merge pull request #192 from stan-dev/markdown-in-roxygen
Use markdown in roxygen
2 parents 39e36f5 + 4a94f36 commit b5ad462

File tree

85 files changed

+2099
-2251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2099
-2251
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ Suggests:
4646
RoxygenNote: 6.1.1
4747
VignetteBuilder: knitr
4848
Encoding: UTF-8
49+
Roxygen: list(markdown = TRUE)

R/available-module-functions.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#' Get or view the names of available plotting functions
22
#'
33
#' @export
4-
#' @param pattern,fixed,invert Passed to \code{\link[base]{grep}}.
4+
#' @param pattern,fixed,invert Passed to [base::grep()].
55
#' @return A possibly empty character vector of function names with several
6-
#' additional attributes (for use by a custom print method). If \code{pattern}
6+
#' additional attributes (for use by a custom print method). If `pattern`
77
#' is missing then the returned object contains the names of all available
8-
#' plotting functions in the \link{MCMC} or \link{PPC} module, depending on
9-
#' which function is called. If \code{pattern} is specified then a subset of
8+
#' plotting functions in the [MCMC] or [PPC] module, depending on
9+
#' which function is called. If `pattern` is specified then a subset of
1010
#' function names is returned.
1111
#'
1212
#' @examples

R/bayesplot-colors.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#' Set, get, or view color schemes
1+
#' Set, get, or view **bayesplot** color schemes
22
#'
33
#' Set, get, or view color schemes. Choose from a preset scheme or create a
44
#' custom scheme. See the **Available color schemes** section below for a list
55
#' of available scheme names. The **Custom color schemes** section describes how
66
#' to specify a custom scheme.
77
#'
8-
#' @md
98
#' @name bayesplot-colors
109
#' @param scheme For `color_scheme_set()`, either a string naming one of the
1110
#' available color schemes or a character vector of _exactly six_ colors
@@ -143,7 +142,6 @@ color_scheme_set <- function(scheme = "blue") {
143142
}
144143

145144
#' @rdname bayesplot-colors
146-
#' @md
147145
#' @export
148146
#' @param i For `color_scheme_get()`, an optional subset of the integers from `1`
149147
#' (lightest) to `6` (darkest) indicating which of the colors in the
@@ -289,9 +287,9 @@ mixed_scheme <- function(scheme1, scheme2) {
289287
scheme
290288
}
291289

292-
#' Check if object returned by color_scheme_get() is a mixed scheme
290+
#' Check if object returned by `color_scheme_get()` is a mixed scheme
293291
#' @noRd
294-
#' @param x object returned by color_scheme_get()
292+
#' @param x object returned by `color_scheme_get()`
295293
#' @return T/F
296294
is_mixed_scheme <- function(x) {
297295
stopifnot(is.list(x))
@@ -300,7 +298,7 @@ is_mixed_scheme <- function(x) {
300298

301299
#' Access a subset of the current scheme colors
302300
#' @noRd
303-
#' @param level A character vector of level names scheme_level_names().
301+
#' @param level A character vector of level names in `scheme_level_names()`.
304302
#' The abbreviations "l", "lh", "m", "mh", "d", and "dh" can also be used
305303
#' instead of the full names.
306304
#' @return A character vector of color values.

R/bayesplot-extractors.R

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,34 @@
22
#'
33
#' Generics and methods for extracting quantities needed for plotting from
44
#' various types of model objects. Currently methods are only provided for
5-
#' stanfit (\pkg{rstan}) and stanreg (\pkg{rstanarm}) objects, but adding new
5+
#' stanfit (**rstan**) and stanreg (**stanreg**) objects, but adding new
66
#' methods should be relatively straightforward.
77
#'
88
#' @name bayesplot-extractors
99
#' @param object The object to use.
1010
#' @param ... Arguments passed to individual methods.
1111
#' @param pars An optional character vector of parameter names. For
12-
#' \code{nuts_params} these will be NUTS sampler parameter names rather than
13-
#' model parameters. If \code{pars} is omitted all parameters are included.
12+
#' `nuts_params()` these will be NUTS sampler parameter names rather than
13+
#' model parameters. If `pars` is omitted all parameters are included.
1414
#'
1515
#' @return
1616
#' \describe{
17-
#' \item{\code{log_posterior}}{
18-
#' \code{log_posterior} methods return a molten data frame (see
19-
#' \code{\link[reshape2]{melt}}). The data frame should have columns
20-
#' \code{"Iteration"} (integer), \code{"Chain"} (integer), and \code{"Value"}
21-
#' (numeric). See \strong{Examples}, below.
17+
#' \item{`log_posterior()`}{
18+
#' `log_posterior()` methods return a molten data frame (see [reshape2::melt()]).
19+
#' The data frame should have columns `"Iteration"` (integer), `"Chain"`
20+
#' (integer), and `"Value"` (numeric). See **Examples**, below.
2221
#' }
23-
#' \item{\code{nuts_params}}{
24-
#' \code{nuts_params} methods return a molten data frame (see
25-
#' \code{\link[reshape2]{melt}}). The data frame should have columns
26-
#' \code{"Parameter"} (factor), \code{"Iteration"} (integer), \code{"Chain"}
27-
#' (integer), and \code{"Value"} (numeric). See \strong{Examples}, below.
22+
#' \item{`nuts_params()`}{
23+
#' `nuts_params()` methods return a molten data frame (see [reshape2::melt()]).
24+
#' The data frame should have columns `"Parameter"` (factor), `"Iteration"`
25+
#' (integer), `"Chain"` (integer), and `"Value"` (numeric). See **Examples**, below.
2826
#' }
29-
#' \item{\code{rhat}, \code{neff_ratio}}{
27+
#' \item{`rhat()`, `neff_ratio()`}{
3028
#' Methods return (named) vectors.
3129
#' }
3230
#' }
3331
#'
34-
#' @seealso \code{\link{MCMC-nuts}}, \code{\link{MCMC-diagnostics}}
32+
#' @seealso [MCMC-nuts], [MCMC-diagnostics]
3533
#'
3634
#' @examples
3735
#' \dontrun{
@@ -80,7 +78,7 @@ neff_ratio <- function(object, ...) {
8078
#' @rdname bayesplot-extractors
8179
#' @export
8280
#' @method log_posterior stanfit
83-
#' @param inc_warmup A logical scalar (defaulting to \code{FALSE}) indicating
81+
#' @param inc_warmup A logical scalar (defaulting to `FALSE`) indicating
8482
#' whether to include warmup draws, if applicable.
8583
#'
8684
log_posterior.stanfit <- function(object, inc_warmup = FALSE, ...) {

R/bayesplot-ggplot-themes.R

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
#' Default bayesplot plotting theme
1+
#' Default **bayesplot** plotting theme
22
#'
3-
#' The \code{\link{theme_default}} function returns the default ggplot
4-
#' \link{theme} used by the \pkg{bayesplot} plotting functions. See
5-
#' \code{\link{bayesplot_theme_set}} for details on setting and updating the
6-
#' plotting theme.
3+
#' The [theme_default()] function returns the default ggplot
4+
#' [theme][ggplot2::theme] used by the **bayesplot** plotting functions. See
5+
#' [bayesplot_theme_set()] for details on setting and updating the plotting
6+
#' theme.
77
#'
88
#' @export
99
#' @param base_size,base_family Base font size and family (passed to
10-
#' \code{\link[ggplot2]{theme_bw}}). It is possible to set
11-
#' \code{"bayesplot.base_size"} and \code{"bayesplot.base_family"} via
12-
#' \code{\link{options}} to change the defaults, which are \code{12} and
13-
#' \code{"serif"}, respectively.
14-
#' @return A ggplot \link[ggplot2]{theme} object.
10+
#' [ggplot2::theme_bw()]). It is possible to set `"bayesplot.base_size"` and
11+
#' `"bayesplot.base_family"` via [options()] to change the defaults, which are
12+
#' `12` and `"serif"`, respectively.
13+
#' @return A ggplot [theme][ggplot2::theme] object.
1514
#'
16-
#' @seealso \code{\link{bayesplot_theme_set}} to change the ggplot theme.
15+
#' @seealso [bayesplot_theme_set()] to change the ggplot theme.
1716
#' @template seealso-colors
1817
#' @template seealso-helpers
1918
#'
@@ -62,36 +61,34 @@ theme_default <-
6261
}
6362

6463

65-
#' Get, set, and modify the active bayesplot theme
64+
#' Get, set, and modify the active **bayesplot** theme
6665
#'
67-
#' @description These functions are the \pkg{bayesplot} equivalent to
68-
#' \pkg{ggplot2}'s \code{\link[ggplot2]{theme_set}} and friends. They set,
69-
#' get, and update the active theme but only apply them to \code{bayesplots}.
70-
#' The current/active theme is automatically applied to every \code{bayesplot}
71-
#' you draw.
66+
#' @description These functions are the **bayesplot** equivalent to
67+
#' **ggplot2**'s [ggplot2::theme_set()] and friends. They set, get, and update
68+
#' the active theme but only apply them to `bayesplots`. The current/active
69+
#' theme is automatically applied to every `bayesplot` you draw.
7270
#'
73-
#' Use \code{bayesplot_theme_get} to get the current \pkg{bayesplot} theme,
74-
#' and \code{bayesplot_theme_set} to change it. \code{bayesplot_theme_update}
75-
#' and \code{bayesplot_theme_replace} are shorthands for changing individual
76-
#' elements.
71+
#' Use `bayesplot_theme_get()` to get the current **bayesplot** theme and
72+
#' `bayesplot_theme_set()` to set a new theme. `bayesplot_theme_update()` and
73+
#' `bayesplot_theme_replace()` are shorthands for changing individual elements.
7774
#'
78-
#' @details \code{bayesplot_theme_set} and friends only apply to
79-
#' \code{bayesplots}. However, \code{ggplot2::theme_set} can also be used to
80-
#' change the \pkg{bayesplot} theme. Currently, setting a theme with
81-
#' \code{ggplot2::theme_set} (other than the \pkg{ggplot2} default
82-
#' \code{\link[ggplot2]{theme_grey}}) will override the \pkg{bayesplot} theme.
75+
#' @details `bayesplot_theme_set()` and friends only apply to `bayesplots`.
76+
#' However, [ggplot2::theme_set()] can also be used to change the
77+
#' **bayesplot** theme. Currently, setting a theme with `ggplot2::theme_set()`
78+
#' (other than the **ggplot2** default [ggplot2::theme_grey()]) will override
79+
#' the **bayesplot** theme.
8380
#'
8481
#' @export
8582
#' @param new The new theme (list of theme elements) to use. This is analogous
86-
#' to the \code{new} argument to \code{\link[ggplot2]{theme_set}}.
83+
#' to the `new` argument to [ggplot2::theme_set()].
8784
#' @param ... A named list of theme settings.
8885
#'
89-
#' @return \code{bayesplot_theme_get} returns the current theme. The other three
90-
#' functions (set, update, replace) invisibly return the \emph{previous} theme
86+
#' @return `bayesplot_theme_get()` returns the current theme. The other three
87+
#' functions (set, update, replace) invisibly return the *previous* theme
9188
#' so it can be saved and easily restored later. This is the same behavior as
92-
#' the \pkg{ggplot2} versions of these functions.
89+
#' the **ggplot2** versions of these functions.
9390
#'
94-
#' @seealso \code{\link{theme_default}} for the default \pkg{bayesplot} theme.
91+
#' @seealso [theme_default()] for the default **bayesplot** theme.
9592
#' @template seealso-helpers
9693
#' @template seealso-colors
9794
#'

0 commit comments

Comments
 (0)