Skip to content

Commit 8778b48

Browse files
authored
Use markdown for documentation (#2166)
* Switch to markdown documentation using roxygen2md::roxygen2md() * Write new Rd files * Undo changes that roxygen2md made to the aesthetics macro * Fix bracketed ranges being treated as links
1 parent 398fc07 commit 8778b48

File tree

223 files changed

+2235
-2234
lines changed

Some content is hidden

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

223 files changed

+2235
-2234
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,4 @@ Collate:
224224
'zzz.r'
225225
VignetteBuilder: knitr
226226
RoxygenNote: 6.0.1
227+
Roxygen: list(markdown = TRUE)

R/aaa-.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ NULL
44
#' Base ggproto classes for ggplot2
55
#'
66
#' If you are creating a new geom, stat, position, or scale in another package,
7-
#' you'll need to extend from \code{ggplot2::Geom}, \code{ggplot2::Stat},
8-
#' \code{ggplot2::Position}, or \code{ggplot2::Scale}.
7+
#' you'll need to extend from `ggplot2::Geom`, `ggplot2::Stat`,
8+
#' `ggplot2::Position`, or `ggplot2::Scale`.
99
#'
1010
#' @seealso ggproto
1111
#' @keywords internal

R/aes.r

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ NULL
2626
#'
2727
#' Aesthetic mappings describe how variables in the data are mapped to visual
2828
#' properties (aesthetics) of geoms. Aesthetic mappings can be set in
29-
#' \code{\link{ggplot2}} and in individual layers.
29+
#' [ggplot2()] and in individual layers.
3030
#'
3131
#' This function also standardise aesthetic names by performing partial
3232
#' matching, converting color to colour, and translating old style R names to
@@ -35,7 +35,7 @@ NULL
3535
#' @param x,y,... List of name value pairs giving aesthetics to map to
3636
#' variables. The names for x and y aesthetics are typically omitted because
3737
#' they are so common; all other aesthetics must be named.
38-
#' @seealso See \code{\link{aes_}} for a version of \code{aes} that is
38+
#' @seealso See [aes_()] for a version of `aes` that is
3939
#' more suitable for programming with.
4040
#' @export
4141
#' @examples
@@ -106,25 +106,25 @@ is_position_aes <- function(vars) {
106106
#' Define aesthetic mappings programatically
107107
#'
108108
#' Aesthetic mappings describe how variables in the data are mapped to visual
109-
#' properties (aesthetics) of geoms. \code{\link{aes}} uses non-standard
110-
#' evaluation to capture the variable names. \code{aes_} and \code{aes_string}
111-
#' require you to explicitly quote the inputs either with \code{""} for
112-
#' \code{aes_string()}, or with \code{quote} or \code{~} for \code{aes_()}.
113-
#' (\code{aes_q} is an alias to \code{aes_}). This makes \code{aes_} and
114-
#' \code{aes_string} easy to program with.
109+
#' properties (aesthetics) of geoms. [aes()] uses non-standard
110+
#' evaluation to capture the variable names. `aes_` and `aes_string`
111+
#' require you to explicitly quote the inputs either with `""` for
112+
#' `aes_string()`, or with `quote` or `~` for `aes_()`.
113+
#' (`aes_q` is an alias to `aes_`). This makes `aes_` and
114+
#' `aes_string` easy to program with.
115115
#'
116-
#' \code{aes_string} and \code{aes_} are particularly useful when writing
116+
#' `aes_string` and `aes_` are particularly useful when writing
117117
#' functions that create plots because you can use strings or quoted
118118
#' names/calls to define the aesthetic mappings, rather than having to use
119-
#' \code{\link{substitute}} to generate a call to \code{aes()}.
119+
#' [substitute()] to generate a call to `aes()`.
120120
#'
121-
#' I recommend using \code{aes_()}, because creating the equivalents of
122-
#' \code{aes(colour = "my colour")} or \code{aes{x = `X$1`}}
123-
#' with \code{aes_string()} is quite clunky.
121+
#' I recommend using `aes_()`, because creating the equivalents of
122+
#' `aes(colour = "my colour")` or \code{aes{x = `X$1`}}
123+
#' with `aes_string()` is quite clunky.
124124
#'
125125
#' @param x,y,... List of name value pairs. Elements must be either
126126
#' quoted calls, strings, one-sided formulas or constants.
127-
#' @seealso \code{\link{aes}}
127+
#' @seealso [aes()]
128128
#' @export
129129
#' @examples
130130
#' # Three ways of generating the same aesthetics

R/annotation-custom.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ NULL
1717
#' @param ymin,ymax y location (in data coordinates) giving vertical
1818
#' location of raster
1919
#' @export
20-
#' @note \code{annotation_custom} expects the grob to fill the entire viewport
20+
#' @note `annotation_custom` expects the grob to fill the entire viewport
2121
#' defined by xmin, xmax, ymin, ymax. Grobs with a different (absolute) size
2222
#' will be center-justified in that region.
2323
#' Inf values can be used to fill the full plot panel (see examples).

R/annotation-logticks.r

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@
55
#'
66
#' @param base the base of the log (default 10)
77
#' @param sides a string that controls which sides of the plot the log ticks appear on.
8-
#' It can be set to a string containing any of \code{"trbl"}, for top, right,
8+
#' It can be set to a string containing any of `"trbl"`, for top, right,
99
#' bottom, and left.
10-
#' @param short a \code{\link[grid]{unit}} object specifying the length of the
10+
#' @param short a [grid::unit()] object specifying the length of the
1111
#' short tick marks
12-
#' @param mid a \code{\link[grid]{unit}} object specifying the length of the
12+
#' @param mid a [grid::unit()] object specifying the length of the
1313
#' middle tick marks. In base 10, these are the "5" ticks.
14-
#' @param long a \code{\link[grid]{unit}} object specifying the length of the
14+
#' @param long a [grid::unit()] object specifying the length of the
1515
#' long tick marks. In base 10, these are the "1" (or "10") ticks.
16-
#' @param scaled is the data already log-scaled? This should be \code{TRUE}
17-
#' (default) when the data is already transformed with \code{log10()} or when
18-
#' using \code{scale_y_log10}. It should be \code{FALSE} when using
19-
#' \code{coord_trans(y = "log10")}.
16+
#' @param scaled is the data already log-scaled? This should be `TRUE`
17+
#' (default) when the data is already transformed with `log10()` or when
18+
#' using `scale_y_log10`. It should be `FALSE` when using
19+
#' `coord_trans(y = "log10")`.
2020
#' @param colour Colour of the tick marks.
2121
#' @param size Thickness of tick marks, in mm.
22-
#' @param linetype Linetype of tick marks (\code{solid}, \code{dashed}, etc.)
22+
#' @param linetype Linetype of tick marks (`solid`, `dashed`, etc.)
2323
#' @param alpha The transparency of the tick marks.
24-
#' @param color An alias for \code{colour}.
24+
#' @param color An alias for `colour`.
2525
#' @param ... Other parameters passed on to the layer
2626
#'
2727
#' @export
28-
#' @seealso \code{\link{scale_y_continuous}}, \code{\link{scale_y_log10}} for log scale
28+
#' @seealso [scale_y_continuous()], [scale_y_log10()] for log scale
2929
#' transformations.
30-
#' @seealso \code{\link{coord_trans}} for log coordinate transformations.
30+
#' @seealso [coord_trans()] for log coordinate transformations.
3131
#'
3232
#' @examples
3333
#' # Make a log-log plot (without log ticks)

R/annotation-map.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NULL
66
#' Display a fixed map on a plot.
77
#'
88
#' @param map data frame representing a map. Most map objects can be
9-
#' converted into the right format by using \code{\link{fortify}}
9+
#' converted into the right format by using [fortify()]
1010
#' @param ... other arguments used to modify aesthetics
1111
#' @export
1212
#' @examples

R/annotation-raster.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ NULL
44

55
#' Annotation: high-performance rectangular tiling
66
#'
7-
#' This is a special version of \code{\link{geom_raster}} optimised for static
7+
#' This is a special version of [geom_raster()] optimised for static
88
#' annotations that are the same in every panel. These annotations will not
99
#' affect scales (i.e. the x and y axes will not grow to cover the range
1010
#' of the raster, and the raster must already have its own colours). This
@@ -15,7 +15,7 @@ NULL
1515
#' location of raster
1616
#' @param ymin,ymax y location (in data coordinates) giving vertical
1717
#' location of raster
18-
#' @param interpolate If \code{TRUE} interpolate linearly, if \code{FALSE}
18+
#' @param interpolate If `TRUE` interpolate linearly, if `FALSE`
1919
#' (the default) don't interpolate.
2020
#' @export
2121
#' @examples

R/autolayer.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#' Create a ggplot layer appropriate to a particular data type
22
#'
3-
#' \code{autolayer} uses ggplot2 to draw a particular layer for an object of a
3+
#' `autolayer` uses ggplot2 to draw a particular layer for an object of a
44
#' particular class in a single command. This defines the S3 generic that
55
#' other classes and packages can extend.
66
#'
77
#' @param object an object, whose class will determine the behaviour of autolayer
88
#' @param ... other arguments passed to specific methods
99
#' @return a ggplot layer
1010
#' @export
11-
#' @seealso \code{\link{autoplot}}, \code{\link{ggplot}} and \code{\link{fortify}}
11+
#' @seealso [autoplot()], [ggplot()] and [fortify()]
1212
autolayer <- function(object, ...) {
1313
UseMethod("autolayer")
1414
}

R/autoplot.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#' Create a complete ggplot appropriate to a particular data type
22
#'
3-
#' \code{autoplot} uses ggplot2 to draw a particular plot for an object of a
3+
#' `autoplot` uses ggplot2 to draw a particular plot for an object of a
44
#' particular class in a single command. This defines the S3 generic that
55
#' other classes and packages can extend.
66
#'
77
#' @param object an object, whose class will determine the behaviour of autoplot
88
#' @param ... other arguments passed to specific methods
99
#' @return a ggplot object
1010
#' @export
11-
#' @seealso \code{\link{autolayer}}, \code{\link{ggplot}} and \code{\link{fortify}}
11+
#' @seealso [autolayer()], [ggplot()] and [fortify()]
1212
autoplot <- function(object, ...) {
1313
UseMethod("autoplot")
1414
}

R/axis-secondary.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010
#'
1111
#' @param breaks One of:
1212
#' \itemize{
13-
#' \item{\code{NULL} for no breaks}
14-
#' \item{\code{waiver()} for the default breaks computed by the transformation object}
13+
#' \item{`NULL` for no breaks}
14+
#' \item{`waiver()` for the default breaks computed by the transformation object}
1515
#' \item{A numeric vector of positions}
1616
#' \item{A function that takes the limits as input and returns breaks as output}
1717
#' }
1818
#'
1919
#' @param labels One of:
2020
#' \itemize{
21-
#' \item{\code{NULL} for no labels}
22-
#' \item{\code{waiver()} for the default labels computed by the transformation object}
23-
#' \item{A character vector giving labels (must be same length as \code{breaks})}
21+
#' \item{`NULL` for no labels}
22+
#' \item{`waiver()` for the default labels computed by the transformation object}
23+
#' \item{A character vector giving labels (must be same length as `breaks`)}
2424
#' \item{A function that takes the breaks as input and returns labels as output}
2525
#' }
2626
#'
2727
#' @details
28-
#' \code{sec_axis} is used to create the specifications for a secondary axis.
29-
#' Except for the \code{trans} argument any of the arguments can be set to
30-
#' \code{derive()} which would result in the secondary axis inheriting the
28+
#' `sec_axis` is used to create the specifications for a secondary axis.
29+
#' Except for the `trans` argument any of the arguments can be set to
30+
#' `derive()` which would result in the secondary axis inheriting the
3131
#' settings from the primary axis.
3232
#'
33-
#' \code{dup_axis} is provide as a shorthand for creating a secondary axis that
33+
#' `dup_axis` is provide as a shorthand for creating a secondary axis that
3434
#' is a duplication of the primary axis, effectively mirroring the primary axis.
3535
#'
3636
#' @examples

R/coord-.r

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
#' @section Coordinate systems:
22
#'
3-
#' All \code{coord_*} functions (like \code{coord_trans}) return a \code{Coord*}
4-
#' object (like \code{CoordTrans}). The \code{Coord*} object is responsible for
3+
#' All `coord_*` functions (like `coord_trans`) return a `Coord*`
4+
#' object (like `CoordTrans`). The `Coord*` object is responsible for
55
#' adjusting the position of overlapping geoms.
66
#'
7-
#' The way that the \code{coord_*} functions work is slightly different from the
8-
#' \code{geom_*} and \code{stat_*} functions, because a \code{coord_*} function
9-
#' actually "instantiates" the \code{Coord*} object by creating a descendant,
7+
#' The way that the `coord_*` functions work is slightly different from the
8+
#' `geom_*` and `stat_*` functions, because a `coord_*` function
9+
#' actually "instantiates" the `Coord*` object by creating a descendant,
1010
#' and returns that.
1111
#'
12-
#' Each of the \code{Coord*} objects is a \code{\link{ggproto}} object,
13-
#' descended from the top-level \code{Coord}. To create a new type of Coord
12+
#' Each of the `Coord*` objects is a [ggproto()] object,
13+
#' descended from the top-level `Coord`. To create a new type of Coord
1414
#' object, you typically will want to implement one or more of the following:
1515
#'
1616
#' \itemize{
17-
#' \item \code{aspect}: Returns the desired aspect ratio for the plot.
18-
#' \item \code{labels}: Returns a list containing labels for x and y.
19-
#' \item \code{render_fg}: Renders foreground elements.
20-
#' \item \code{render_bg}: Renders background elements.
21-
#' \item \code{render_axis_h}: Renders the horizontal axes.
22-
#' \item \code{render_axis_v}: Renders the vertical axes.
23-
#' \item \code{range}: Returns the x and y ranges
24-
#' \item \code{train}: Return the trained scale ranges.
25-
#' \item \code{transform}: Transforms x and y coordinates.
26-
#' \item \code{distance}: Calculates distance.
27-
#' \item \code{is_linear}: Returns \code{TRUE} if the coordinate system is
28-
#' linear; \code{FALSE} otherwise.
17+
#' \item `aspect`: Returns the desired aspect ratio for the plot.
18+
#' \item `labels`: Returns a list containing labels for x and y.
19+
#' \item `render_fg`: Renders foreground elements.
20+
#' \item `render_bg`: Renders background elements.
21+
#' \item `render_axis_h`: Renders the horizontal axes.
22+
#' \item `render_axis_v`: Renders the vertical axes.
23+
#' \item `range`: Returns the x and y ranges
24+
#' \item `train`: Return the trained scale ranges.
25+
#' \item `transform`: Transforms x and y coordinates.
26+
#' \item `distance`: Calculates distance.
27+
#' \item `is_linear`: Returns `TRUE` if the coordinate system is
28+
#' linear; `FALSE` otherwise.
2929
#'
30-
#' \item \code{setup_params(data)}: Allows the coordinate system to inspect
30+
#' \item `setup_params(data)`: Allows the coordinate system to inspect
3131
#' all layers and return a list of additional parameters that vary based on
3232
#' the data. These parameters are currently only passed to the other
33-
#' setup functions and \code{train()}.
34-
#' \item \code{setup_data(data, params)}: Allows the coordinate system to
33+
#' setup functions and `train()`.
34+
#' \item `setup_data(data, params)`: Allows the coordinate system to
3535
#' manipulate the plot data. Should return list of data frames.
36-
#' \item \code{setup_layout(layout, params)}: Allows the coordinate
37-
#' system to manipulate the \code{layout} data frame which assigns
36+
#' \item `setup_layout(layout, params)`: Allows the coordinate
37+
#' system to manipulate the `layout` data frame which assigns
3838
#' data to panels and scales.
3939
#' }
4040
#'

R/coord-cartesian-.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#' change the underlying data like setting limits on a scale will.
77
#'
88
#' @param xlim,ylim Limits for the x and y axes.
9-
#' @param expand If \code{TRUE}, the default, adds a small expansion factor to
10-
#' the limits to ensure that data and axes don't overlap. If \code{FALSE},
11-
#' limits are taken exactly from the data or \code{xlim}/\code{ylim}.
9+
#' @param expand If `TRUE`, the default, adds a small expansion factor to
10+
#' the limits to ensure that data and axes don't overlap. If `FALSE`,
11+
#' limits are taken exactly from the data or `xlim`/`ylim`.
1212
#' @export
1313
#' @examples
1414
#' # There are two ways of zooming the plot display: with scales or

R/coord-fixed.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
#' A fixed scale coordinate system forces a specified ratio between the
44
#' physical representation of data units on the axes. The ratio represents the
55
#' number of units on the y-axis equivalent to one unit on the x-axis. The
6-
#' default, \code{ratio = 1}, ensures that one unit on the x-axis is the same
6+
#' default, `ratio = 1`, ensures that one unit on the x-axis is the same
77
#' length as one unit on the y-axis. Ratios higher than one make units on the
88
#' y axis longer than units on the x-axis, and vice versa. This is similar to
9-
#' \code{\link[MASS]{eqscplot}}, but it works for all types of graphics.
9+
#' [MASS::eqscplot()], but it works for all types of graphics.
1010
#'
1111
#' @export
1212
#' @inheritParams coord_cartesian
13-
#' @param ratio aspect ratio, expressed as \code{y / x}
13+
#' @param ratio aspect ratio, expressed as `y / x`
1414
#' @examples
1515
#' # ensures that the ranges of axes are equal to the specified ratio by
1616
#' # adjusting the plot aspect ratio

R/coord-map.r

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#' Map projections
22
#'
3-
#' \code{coord_map} projects a portion of the earth, which is approximately
3+
#' `coord_map` projects a portion of the earth, which is approximately
44
#' spherical, onto a flat 2D plane using any projection defined by the
5-
#' \code{mapproj} package. Map projections do not, in general, preserve straight
6-
#' lines, so this requires considerable computation. \code{coord_quickmap} is a
5+
#' `mapproj` package. Map projections do not, in general, preserve straight
6+
#' lines, so this requires considerable computation. `coord_quickmap` is a
77
#' quick approximation that does preserve straight lines. It works best for
88
#' smaller areas closer to the equator.
99
#'
@@ -15,19 +15,19 @@
1515
#' 0. For regions that span only a few degrees and are not too close to the
1616
#' poles, setting the aspect ratio of the plot to the appropriate lat/lon ratio
1717
#' approximates the usual mercator projection. This is what
18-
#' \code{coord_quickmap} does, and is much faster (particularly for complex
19-
#' plots like \code{\link{geom_tile}}) at the expense of correctness.
18+
#' `coord_quickmap` does, and is much faster (particularly for complex
19+
#' plots like [geom_tile()]) at the expense of correctness.
2020
#'
2121
#' @param projection projection to use, see
22-
#' \code{\link[mapproj]{mapproject}} for list
22+
#' [mapproj::mapproject()] for list
2323
#' @param ...,parameters Other arguments passed on to
24-
#' \code{\link[mapproj]{mapproject}}. Use \code{...} for named parameters to
25-
#' the projection, and \code{parameters} for unnamed parameters.
26-
#' \code{...} is ignored if the \code{parameters} argument is present.
24+
#' [mapproj::mapproject()]. Use `...` for named parameters to
25+
#' the projection, and `parameters` for unnamed parameters.
26+
#' `...` is ignored if the `parameters` argument is present.
2727
#' @param orientation projection orientation, which defaults to
28-
#' \code{c(90, 0, mean(range(x)))}. This is not optimal for many
28+
#' `c(90, 0, mean(range(x)))`. This is not optimal for many
2929
#' projections, so you will have to supply your own. See
30-
#' \code{\link[mapproj]{mapproject}} for more information.
30+
#' [mapproj::mapproject()] for more information.
3131
#' @param xlim,ylim Manually specific x/y limits (in degrees of
3232
#' longitude/latitude)
3333
#' @export

R/coord-munch.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#' so they can be transformed independently. Used inside geom functions.
55
#'
66
#' @param coord Coordinate system definition.
7-
#' @param data Data set to transform - should have variables \code{x} and
8-
#' \code{y} are chopped up into small pieces (as defined by \code{group}).
7+
#' @param data Data set to transform - should have variables `x` and
8+
#' `y` are chopped up into small pieces (as defined by `group`).
99
#' All other variables are duplicated as needed.
1010
#' @param range Panel range specification.
1111
#' @param segment_length Target segment length

R/coord-polar.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' The polar coordinate system is most commonly used for pie charts, which
44
#' are a stacked bar chart in polar coordinates.
55
#'
6-
#' @param theta variable to map angle to (\code{x} or \code{y})
6+
#' @param theta variable to map angle to (`x` or `y`)
77
#' @param start offset of starting point from 12 o'clock in radians
88
#' @param direction 1, clockwise; -1, anticlockwise
99
#' @export

R/coord-transform.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#' Transformed Cartesian coordinate system
22
#'
3-
#' \code{coord_trans} is different to scale transformations in that it occurs after
3+
#' `coord_trans` is different to scale transformations in that it occurs after
44
#' statistical transformation and will affect the visual appearance of geoms - there is
55
#' no guarantee that straight lines will continue to be straight.
66
#'
77
#' Transformations only work with continuous values: see
8-
#' \code{\link[scales]{trans_new}} for list of transformations, and instructions
8+
#' [scales::trans_new()] for list of transformations, and instructions
99
#' on how to create your own.
1010
#'
1111
#' @param x,y transformers for x and y axes
12-
#' @param xtrans,ytrans Deprecated; use \code{x} and \code{y} instead.
12+
#' @param xtrans,ytrans Deprecated; use `x` and `y` instead.
1313
#' @param limx,limy limits for x and y axes. (Named so for backward
1414
#' compatibility)
1515
#' @export

0 commit comments

Comments
 (0)