From cd2f2ca1b1d82f007ad12da644f13ec4346e9e0d Mon Sep 17 00:00:00 2001 From: olivroy Date: Wed, 27 Mar 2024 19:52:55 -0400 Subject: [PATCH] Use roxygen md + minor doc tweaks. --- DESCRIPTION | 1 + R/layers.R | 6 +++--- R/legend.R | 8 ++++---- R/mapPane.R | 2 +- R/plugin-providers.R | 3 ++- man/addAwesomeMarkers.Rd | 2 +- man/addGraticule.Rd | 2 +- man/addLegend.Rd | 8 ++++---- man/addMapPane.Rd | 2 +- man/addMiniMap.Rd | 2 +- man/addRasterImage.Rd | 2 +- man/addSimpleGraticule.Rd | 2 +- man/colorNumeric.Rd | 40 +++++++++++++++++++-------------------- man/derivePoints.Rd | 12 +++++++----- man/dispatch.Rd | 4 ++-- man/expandLimitsBbox.Rd | 2 +- man/filterNULL.Rd | 2 +- man/icons.Rd | 2 +- man/leaflet.Rd | 2 +- man/map-layers.Rd | 8 ++++---- man/map-options.Rd | 6 +++--- man/providers.Rd | 3 +++ man/remove.Rd | 32 +++++++++++++++---------------- man/showGroup.Rd | 2 +- 24 files changed, 81 insertions(+), 74 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6defb1962..79ae9aba7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -82,3 +82,4 @@ Config/Needs/website: dplyr, geojsonio, ncdf4, tidyverse/tidytemplate Encoding: UTF-8 LazyData: true RoxygenNote: 7.3.1 +Roxygen: list(markdown = TRUE) diff --git a/R/layers.R b/R/layers.R index 104f7b2fa..161cec377 100644 --- a/R/layers.R +++ b/R/layers.R @@ -678,7 +678,7 @@ gridOptions <- function( #' Remove one or more features from a map, identified by \code{layerId}; or, #' clear all features of the given type or group. #' -#' @note When used with a \code{\link{leaflet}}() map object, these functions +#' @note When used with a [leaflet][leaflet()] map object, these functions #' don't actually remove the features from the map object, but simply add an #' operation that will cause those features to be removed after they are #' added. In other words, if you add a polygon \code{"foo"} and the call @@ -692,8 +692,8 @@ gridOptions <- function( #' #' WMS tile layers are extensions of tile layers, so they can also be removed #' or cleared via \code{removeTiles()} or \code{clearTiles()}. -#' @param map a map widget object, possibly created from \code{\link{leaflet}}() -#' but more likely from \code{\link{leafletProxy}}() +#' @param map a map widget object, possibly created from [leaflet()] +#' but more likely from [leafletProxy()] #' @param layerId character vector; the layer id(s) of the item to remove #' @return the new \code{map} object #' diff --git a/R/legend.R b/R/legend.R index d729a588d..99fca353d 100644 --- a/R/legend.R +++ b/R/legend.R @@ -46,13 +46,13 @@ #' write your own function) #' @param title the legend title #' @param className extra CSS classes to append to the control, space separated -#' @param layerId the ID of the legend; subsequent calls to \code{addLegend} -#' or \code{addControl} with the same \code{layerId} will replace this -#' legend. The ID can also be used with \code{removeControl}. +#' @param layerId the ID of the legend; subsequent calls to \code{addLegend()} +#' or \code{addControl()} with the same \code{layerId} will replace this +#' legend. The ID can also be used with \code{removeControl()}. #' @param group \code{group} name of a leaflet layer group. #' Supplying this value will tie the legend to the leaflet layer group #' with this name and will auto add/remove the legend as the -#' group is added/removed, for example via layerControl. +#' group is added/removed, for example via `layerControl()`. #' You will need to set the \code{group} when you add a layer #' (e.g. \code{\link{addPolygons}}) and supply the same name here. #' @template data-getMapData diff --git a/R/mapPane.R b/R/mapPane.R index ff8ae02f2..733c40407 100644 --- a/R/mapPane.R +++ b/R/mapPane.R @@ -5,7 +5,7 @@ #' ordering. We recommend a \code{zIndex} value between 400 (the default #' overlay pane) and 500 (the default shadow pane). You can then use this pane #' to render overlays (points, lines, polygons) by setting the \code{pane} -#' argument in \code{leafletOptions}. This will give you control +#' argument in [leafletOptions]. This will give you control #' over the order of the layers, e.g. points always on top of polygons. #' If two layers are provided to the same pane, overlay will be determined by #' order of adding. See examples below. diff --git a/R/plugin-providers.R b/R/plugin-providers.R index b67b32d90..a6789c246 100644 --- a/R/plugin-providers.R +++ b/R/plugin-providers.R @@ -71,7 +71,8 @@ providerTileOptions <- function(errorTileUrl = "", noWrap = FALSE, #' #' @name providers #' @export providers -#' @rdname providers +#' @examples +#' providers NULL # Active binding added in zzz.R "providers" diff --git a/man/addAwesomeMarkers.Rd b/man/addAwesomeMarkers.Rd index 5f50892d8..87b2e3b1c 100644 --- a/man/addAwesomeMarkers.Rd +++ b/man/addAwesomeMarkers.Rd @@ -60,7 +60,7 @@ options for each label. Default \code{NULL}} \item{clusterOptions}{if not \code{NULL}, markers will be clustered using \href{https://github.com/Leaflet/Leaflet.markercluster}{Leaflet.markercluster}; - you can use \code{\link{markerClusterOptions}()} to specify marker cluster +you can use \code{\link{markerClusterOptions}()} to specify marker cluster options} \item{clusterId}{the id for the marker cluster layer} diff --git a/man/addGraticule.Rd b/man/addGraticule.Rd index b9167d032..73554a2ad 100644 --- a/man/addGraticule.Rd +++ b/man/addGraticule.Rd @@ -19,7 +19,7 @@ addGraticule( \item{interval}{The spacing in map units between horizontal and vertical lines.} -\item{sphere}{boolean. Default `FALSE`} +\item{sphere}{boolean. Default \code{FALSE}} \item{style}{path options for the generated lines. See \url{https://web.archive.org/web/20220702182250/https://leafletjs.com/reference-1.3.4.html#path-option}} diff --git a/man/addLegend.Rd b/man/addLegend.Rd index c45dca57c..30d63aabb 100644 --- a/man/addLegend.Rd +++ b/man/addLegend.Rd @@ -66,14 +66,14 @@ write your own function)} \item{className}{extra CSS classes to append to the control, space separated} -\item{layerId}{the ID of the legend; subsequent calls to \code{addLegend} -or \code{addControl} with the same \code{layerId} will replace this -legend. The ID can also be used with \code{removeControl}.} +\item{layerId}{the ID of the legend; subsequent calls to \code{addLegend()} +or \code{addControl()} with the same \code{layerId} will replace this +legend. The ID can also be used with \code{removeControl()}.} \item{group}{\code{group} name of a leaflet layer group. Supplying this value will tie the legend to the leaflet layer group with this name and will auto add/remove the legend as the -group is added/removed, for example via layerControl. +group is added/removed, for example via \code{layerControl()}. You will need to set the \code{group} when you add a layer (e.g. \code{\link{addPolygons}}) and supply the same name here.} diff --git a/man/addMapPane.Rd b/man/addMapPane.Rd index cbe096f6e..ecdf193e4 100644 --- a/man/addMapPane.Rd +++ b/man/addMapPane.Rd @@ -19,7 +19,7 @@ map panes can be created by supplying a name and a zIndex to control layer ordering. We recommend a \code{zIndex} value between 400 (the default overlay pane) and 500 (the default shadow pane). You can then use this pane to render overlays (points, lines, polygons) by setting the \code{pane} -argument in \code{leafletOptions}. This will give you control +argument in \link{leafletOptions}. This will give you control over the order of the layers, e.g. points always on top of polygons. If two layers are provided to the same pane, overlay will be determined by order of adding. See examples below. diff --git a/man/addMiniMap.Rd b/man/addMiniMap.Rd index 7ab01ec36..7fc52d66f 100644 --- a/man/addMiniMap.Rd +++ b/man/addMiniMap.Rd @@ -31,7 +31,7 @@ addMiniMap( \item{position}{The standard Leaflet.Control position parameter, used like all the other controls. -Defaults to `"bottomright"`.} +Defaults to \code{"bottomright"}.} \item{width}{The width of the minimap in pixels. Defaults to 150.} diff --git a/man/addRasterImage.Rd b/man/addRasterImage.Rd index 5f7f87b48..93fe19885 100644 --- a/man/addRasterImage.Rd +++ b/man/addRasterImage.Rd @@ -107,5 +107,5 @@ leaflet() \%>\% addTiles() \%>\% } \seealso{ \code{\link{addRasterLegend}} for an easy way to add a legend for a - SpatRaster with a color table. +SpatRaster with a color table. } diff --git a/man/addSimpleGraticule.Rd b/man/addSimpleGraticule.Rd index f6944b326..59899cab2 100644 --- a/man/addSimpleGraticule.Rd +++ b/man/addSimpleGraticule.Rd @@ -22,7 +22,7 @@ addSimpleGraticule( \item{showOriginLabel}{true Whether or not to show '(0,0)' at the origin.} -\item{redraw}{on which map event to redraw the graticule. On move is default but `"moveend"` can be smoother.} +\item{redraw}{on which map event to redraw the graticule. On move is default but \code{"moveend"} can be smoother.} \item{hidden}{hide on start} diff --git a/man/colorNumeric.Rd b/man/colorNumeric.Rd index 21b979073..b503ba91d 100644 --- a/man/colorNumeric.Rd +++ b/man/colorNumeric.Rd @@ -52,15 +52,15 @@ colorFactor( \item{domain}{The possible values that can be mapped. - For \code{colorNumeric} and \code{colorBin}, this can be a simple numeric - range (e.g. \code{c(0, 100)}); \code{colorQuantile} needs representative - numeric data; and \code{colorFactor} needs categorical data. +For \code{colorNumeric} and \code{colorBin}, this can be a simple numeric +range (e.g. \code{c(0, 100)}); \code{colorQuantile} needs representative +numeric data; and \code{colorFactor} needs categorical data. - If \code{NULL}, then whenever the resulting color function is called, the - \code{x} value will represent the domain. This implies that if the function - is invoked multiple times, the encoding between values and colors may not - be consistent; if consistency is needed, you must provide a non-\code{NULL} - domain.} +If \code{NULL}, then whenever the resulting color function is called, the +\code{x} value will represent the domain. This implies that if the function +is invoked multiple times, the encoding between values and colors may not +be consistent; if consistency is needed, you must provide a non-\code{NULL} +domain.} \item{na.color}{The color to return for \code{NA} values. Note that \code{na.color = NA} is valid.} @@ -100,9 +100,9 @@ factor, treat it as already in the correct order} } \value{ A function that takes a single parameter \code{x}; when called with a - vector of numbers (except for \code{colorFactor}, which expects - factors/characters), #RRGGBB color strings are returned (unless - \code{alpha = TRUE} in which case #RRGGBBAA may also be possible). +vector of numbers (except for \code{colorFactor}, which expects +factors/characters), #RRGGBB color strings are returned (unless +\code{alpha = TRUE} in which case #RRGGBBAA may also be possible). } \description{ Conveniently maps data values (numeric or factor/character) to colors @@ -113,23 +113,23 @@ according to a given palette, which can be provided in a variety of formats. to an interpolated palette. \code{colorBin} also maps continuous numeric data, but performs - binning based on value (see the \code{\link[base]{cut}} function). \code{colorBin} - defaults for the \code{\link[base]{cut}} function are \code{include.lowest +binning based on value (see the \code{\link[base]{cut}} function). \code{colorBin} +defaults for the \code{\link[base]{cut}} function are \code{include.lowest = TRUE} and \code{right = FALSE}. \code{colorQuantile} similarly bins numeric data, but via the - \code{\link[stats]{quantile}} function. +\code{\link[stats]{quantile}} function. \code{colorFactor} maps factors to colors. If the palette is - discrete and has a different number of colors than the number of factors, - interpolation is used. +discrete and has a different number of colors than the number of factors, +interpolation is used. The \code{palette} argument can be any of the following: \enumerate{ - \item{A character vector of RGB or named colors. Examples: \code{palette()}, \code{c("#000000", "#0000FF", "#FFFFFF")}, \code{topo.colors(10)}} - \item{The name of an RColorBrewer palette, e.g. \code{"BuPu"} or \code{"Greens"}.} - \item{The full name of a viridis palette: \code{"viridis"}, \code{"magma"}, \code{"inferno"}, or \code{"plasma"}.} - \item{A function that receives a single value between 0 and 1 and returns a color. Examples: \code{colorRamp(c("#000000", "#FFFFFF"), interpolate = "spline")}.} +\item{A character vector of RGB or named colors. Examples: \code{palette()}, \code{c("#000000", "#0000FF", "#FFFFFF")}, \code{topo.colors(10)}} +\item{The name of an RColorBrewer palette, e.g. \code{"BuPu"} or \code{"Greens"}.} +\item{The full name of a viridis palette: \code{"viridis"}, \code{"magma"}, \code{"inferno"}, or \code{"plasma"}.} +\item{A function that receives a single value between 0 and 1 and returns a color. Examples: \code{colorRamp(c("#000000", "#FFFFFF"), interpolate = "spline")}.} } } \examples{ diff --git a/man/derivePoints.Rd b/man/derivePoints.Rd index 32f0f3d2b..592c89f43 100644 --- a/man/derivePoints.Rd +++ b/man/derivePoints.Rd @@ -35,12 +35,14 @@ derivePolygons( \item{funcName}{Name of calling function (for logging)} } \value{ -* `derivePoints()` returns a lng/lat data frame. -* `derivePolygons()` returns a list with bbox attributes. +\itemize{ +\item \code{derivePoints()} returns a lng/lat data frame. +\item \code{derivePolygons()} returns a list with bbox attributes. +} } \description{ -Given a data object and lng/lat arguments (which may be `NULL`) -[meaning infer from data], formula [which should be evaluated with respect to the data], or -vector data [which should be used as-is]) return a lng/lat data frame. +Given a data object and lng/lat arguments (which may be \code{NULL}) +\link{meaning infer from data}, formula \link{which should be evaluated with respect to the data}, or +vector data \link{which should be used as-is}) return a lng/lat data frame. } \keyword{internal} diff --git a/man/dispatch.Rd b/man/dispatch.Rd index eb4a2b9f3..1b002b710 100644 --- a/man/dispatch.Rd +++ b/man/dispatch.Rd @@ -36,8 +36,8 @@ this \code{dispatch} call; for error message purposes} } \value{ \code{dispatch} returns the value of \code{leaflet} or - \code{leaflet_proxy}, or an error. \code{invokeMethod} returns the - \code{map} object that was passed in, possibly modified. +\code{leaflet_proxy}, or an error. \code{invokeMethod} returns the +\code{map} object that was passed in, possibly modified. } \description{ Extension points for plugins diff --git a/man/expandLimitsBbox.Rd b/man/expandLimitsBbox.Rd index 17785edc7..e9f26a7a7 100644 --- a/man/expandLimitsBbox.Rd +++ b/man/expandLimitsBbox.Rd @@ -12,6 +12,6 @@ expandLimitsBbox(map, poly) \item{poly}{A spatial object representing a polygon.} } \description{ -Same as `expandLimits()`, but takes a polygon (that presumably has a bbox attr) +Same as \code{expandLimits()}, but takes a polygon (that presumably has a bbox attr) rather than lat/lng. } diff --git a/man/filterNULL.Rd b/man/filterNULL.Rd index a318cb83c..1cc62fe92 100644 --- a/man/filterNULL.Rd +++ b/man/filterNULL.Rd @@ -10,7 +10,7 @@ filterNULL(x) \item{x}{A list.} } \value{ -A list with `NULL` elements filtered out. +A list with \code{NULL} elements filtered out. } \description{ Remove NULL elements from a list diff --git a/man/icons.Rd b/man/icons.Rd index 5495b9f94..2ff482d47 100644 --- a/man/icons.Rd +++ b/man/icons.Rd @@ -51,7 +51,7 @@ popups will "open", relative to the icon anchor} } \value{ A list of icon data that can be passed to the \code{icon} argument of - \code{\link{addMarkers}()}. +\code{\link{addMarkers}()}. } \description{ An icon can be represented as a list of the form \code{list(iconUrl, diff --git a/man/leaflet.Rd b/man/leaflet.Rd index c6af1307b..11738cbf8 100644 --- a/man/leaflet.Rd +++ b/man/leaflet.Rd @@ -96,7 +96,7 @@ defaulting to Leaflet's default CRS size} } \value{ A HTML widget object, on which we can add graphics layers using - \code{\%>\%} (see examples). +\code{\%>\%} (see examples). } \description{ This function creates a Leaflet map widget using \pkg{htmlwidgets}. The diff --git a/man/map-layers.Rd b/man/map-layers.Rd index acece3965..f8567b2a7 100644 --- a/man/map-layers.Rd +++ b/man/map-layers.Rd @@ -330,7 +330,7 @@ options for each label. Default \code{NULL}} \item{clusterOptions}{if not \code{NULL}, markers will be clustered using \href{https://github.com/Leaflet/Leaflet.markercluster}{Leaflet.markercluster}; - you can use \code{\link{markerClusterOptions}()} to specify marker cluster +you can use \code{\link{markerClusterOptions}()} to specify marker cluster options} \item{clusterId}{the id for the marker cluster layer} @@ -416,10 +416,10 @@ Add graphics elements and layers to the map widget. }} \references{ The Leaflet API documentation: - \url{https://web.archive.org/web/20220702182250/https://leafletjs.com/reference-1.3.4.html} +\url{https://web.archive.org/web/20220702182250/https://leafletjs.com/reference-1.3.4.html} } \seealso{ \code{\link{tileOptions}}, \code{\link{WMSTileOptions}}, - \code{\link{popupOptions}}, \code{\link{markerOptions}}, - \code{\link{pathOptions}} +\code{\link{popupOptions}}, \code{\link{markerOptions}}, +\code{\link{pathOptions}} } diff --git a/man/map-options.Rd b/man/map-options.Rd index 3d0faf412..969e3929b 100644 --- a/man/map-options.Rd +++ b/man/map-options.Rd @@ -176,11 +176,11 @@ See \url{https://github.com/ghybs/Leaflet.MarkerCluster.Freezable#api-reference} \item{lineCap}{a string that defines \href{https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap}{shape - to be used at the end} of the stroke} +to be used at the end} of the stroke} \item{lineJoin}{a string that defines \href{https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linejoin}{shape - to be used at the corners} of the stroke} +to be used at the corners} of the stroke} \item{pointerEvents}{sets the \code{pointer-events} attribute on the path if SVG backend is used} @@ -211,5 +211,5 @@ rectangles, and circles, etc) }} \seealso{ \code{\link{leafletCRS}} - to map CRS (don't change this if you're not sure what it means) +to map CRS (don't change this if you're not sure what it means) } diff --git a/man/providers.Rd b/man/providers.Rd index 37008ea57..9da8c21ab 100644 --- a/man/providers.Rd +++ b/man/providers.Rd @@ -13,3 +13,6 @@ A list of characters \description{ List of all providers with their variations } +\examples{ +providers +} diff --git a/man/remove.Rd b/man/remove.Rd index 21cfcb925..c95d0dc2b 100644 --- a/man/remove.Rd +++ b/man/remove.Rd @@ -69,8 +69,8 @@ removeTopoJSON(map, layerId) clearTopoJSON(map) } \arguments{ -\item{map}{a map widget object, possibly created from \code{\link{leaflet}}() -but more likely from \code{\link{leafletProxy}}()} +\item{map}{a map widget object, possibly created from \code{\link[=leaflet]{leaflet()}} +but more likely from \code{\link[=leafletProxy]{leafletProxy()}}} \item{layerId}{character vector; the layer id(s) of the item to remove} @@ -86,18 +86,18 @@ Remove one or more features from a map, identified by \code{layerId}; or, clear all features of the given type or group. } \note{ -When used with a \code{\link{leaflet}}() map object, these functions - don't actually remove the features from the map object, but simply add an - operation that will cause those features to be removed after they are - added. In other words, if you add a polygon \code{"foo"} and the call - \code{removeShape("foo")}, it's not smart enough to prevent the polygon - from being added in the first place; instead, when the map is rendered, the - polygon will be added and then removed. - - For that reason, these functions aren't that useful with \code{leaflet} map - objects and are really intended to be used with \code{\link{leafletProxy}} - instead. - - WMS tile layers are extensions of tile layers, so they can also be removed - or cleared via \code{removeTiles()} or \code{clearTiles()}. +When used with a \link[=leaflet]{leaflet} map object, these functions +don't actually remove the features from the map object, but simply add an +operation that will cause those features to be removed after they are +added. In other words, if you add a polygon \code{"foo"} and the call +\code{removeShape("foo")}, it's not smart enough to prevent the polygon +from being added in the first place; instead, when the map is rendered, the +polygon will be added and then removed. + +For that reason, these functions aren't that useful with \code{leaflet} map +objects and are really intended to be used with \code{\link{leafletProxy}} +instead. + +WMS tile layers are extensions of tile layers, so they can also be removed +or cleared via \code{removeTiles()} or \code{clearTiles()}. } diff --git a/man/showGroup.Rd b/man/showGroup.Rd index 35b5e7511..f64621a1d 100644 --- a/man/showGroup.Rd +++ b/man/showGroup.Rd @@ -21,5 +21,5 @@ adding functions. } \seealso{ \code{\link{addLayersControl}} to allow users to show/hide layer - groups interactively +groups interactively }