diff --git a/R/colors.R b/R/colors.R index 2ea4481cf..3d9a8d0d7 100644 --- a/R/colors.R +++ b/R/colors.R @@ -3,7 +3,7 @@ #' Conveniently maps data values (numeric or factor/character) to colors #' according to a given palette, which can be provided in a variety of formats. #' -#' `colorNumeric` is a simple linear mapping from continuous numeric data +#' `colorNumeric()` is a simple linear mapping from continuous numeric data #' to an interpolated palette. #' #' @param palette The colors or color function that values will be mapped to @@ -93,8 +93,8 @@ getBins <- function(domain, x, bins, pretty) { } } -#' @details `colorBin` also maps continuous numeric data, but performs -#' binning based on value (see the [base::cut()] function). `colorBin` +#' @details `colorBin()` also maps continuous numeric data, but performs +#' binning based on value (see the [base::cut()] function). `colorBin()` #' defaults for the [base::cut()] function are `include.lowest #' = TRUE` and `right = FALSE`. #' @param bins Either a numeric vector of two or more unique cut points or a @@ -136,12 +136,10 @@ colorBin <- function(palette, domain, bins = 7, pretty = TRUE, }) } -#' @details `colorQuantile()` similarly bins numeric data, but via the -#' [stats::quantile()] function. +#' @details `colorQuantile()` similarly bins numeric data, but via [stats::quantile()]. #' @param n Number of equal-size quantiles desired. For more precise control, -#' use the `probs` argument instead. -#' @param probs See [stats::quantile()]. If provided, the `n` -#' argument is ignored. +#' use `probs` instead. +#' @param probs See [stats::quantile()]. If provided, `n` is ignored. #' @rdname colorNumeric #' @export colorQuantile <- function(palette, domain, n = 4, diff --git a/R/controls.R b/R/controls.R index 152df7151..4300f12a7 100644 --- a/R/controls.R +++ b/R/controls.R @@ -1,7 +1,7 @@ #' @param html the content of the control. May be provided as string or as HTML #' generated with Shiny/htmltools tags -#' @param position position of control: "topleft", "topright", "bottomleft", or -#' "bottomright" +#' @param position position of control: `"topleft"`, `"topright"`, +#' `"bottomleft"`, or `"bottomright"`. #' @param className extra CSS classes to append to the control, space separated #' #' @describeIn map-layers Add arbitrary HTML controls to the map diff --git a/R/layers.R b/R/layers.R index 9caffc5d4..96a454497 100644 --- a/R/layers.R +++ b/R/layers.R @@ -197,13 +197,13 @@ epsg3857 <- "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y #' a `RasterLayer` you can use [raster::sampleRegular()] as in #' `sampleRegular(x, 100000, asRaster=TRUE)`. #' -#' By default, the `addRasterImage` function will project the raster data +#' By default, `addRasterImage()` will project the raster data #' `x` to the Pseudo-Mercator projection (EPSG:3857). This can be a #' time-consuming operation for even moderately sized rasters; although it is much #' faster for SpatRasters than for RasterLayers. #' If you are repeatedly adding a particular raster to your Leaflet #' maps, you can perform the projection ahead of time using -#' `projectRasterForLeaflet()`, and call `addRasterImage` with +#' `projectRasterForLeaflet()`, and call `addRasterImage()` with #' `project = FALSE`. #' #' @param map a map widget object @@ -1175,7 +1175,7 @@ b64EncodePackedIcons <- function(packedIcons) { } #' @param interactive whether the element emits mouse events -#' @param clickable DEPRECATED! Use the `interactive` option. +#' @param clickable DEPRECATED! Use the `interactive` argument. #' @param #' draggable,keyboard,title,alt,zIndexOffset,riseOnHover,riseOffset #' marker options; see @@ -1597,8 +1597,8 @@ clearGeoJSON <- function(map) { #' most commonly used for mostly-opaque tile layers. #' @param overlayGroups character vector where each element is the name of a #' group. The user can turn each overlay group on or off independently. -#' @param position position of control: "topleft", "topright", "bottomleft", or -#' "bottomright" +#' @param position position of control: `"topleft"`, `"topright"`, +#' `"bottomleft"`, or `"bottomright"`. #' @param options a list of additional options, intended to be provided by #' a call to `layersControlOptions()` #' @template data-getMapData diff --git a/R/leaflet.R b/R/leaflet.R index f47361446..9172da107 100644 --- a/R/leaflet.R +++ b/R/leaflet.R @@ -1,14 +1,13 @@ #' Leaflet sizing policy #' #' Sizing policy used withing leaflet htmlwidgets. -#' All arguments are passed directly to [htmlwidgets::sizingPolicy()] #' #' @export #' @param defaultWidth defaults to `"100%"` of the available width #' @param defaultHeight defaults to 400px tall #' @param padding defaults to 0px #' @param browser.fill defaults to `TRUE` -#' @param ... all other arguments supplied to [htmlwidgets::sizingPolicy()] +#' @inheritDotParams htmlwidgets::sizingPolicy #' @return An `htmlwidgets::sizingPolicy` object leafletSizingPolicy <- function( defaultWidth = "100%", @@ -140,11 +139,13 @@ mapOptions <- function(map, zoomToLimits = c("always", "first", "never")) { } #' Options for Map creation -#' @param minZoom Minimum zoom level of the map. Overrides any minZoom set on map layers. -#' @param maxZoom Maximum zoom level of the map. This overrides any maxZoom set on map layers. +#' @param minZoom Minimum zoom level of the map. Overrides any `minZoom` set on map layers. +#' @param maxZoom Maximum zoom level of the map. This overrides any `maxZoom` set on map layers. #' @param crs Coordinate Reference System to use. Don't change this if you're not sure what it means. #' @seealso [leafletCRS()] for creating a custom CRS. -#' @param worldCopyJump With this option enabled, the map tracks when you pan to another "copy" of the world and seamlessly jumps to the original one so that all overlays like markers and vector layers are still visible. +#' @param worldCopyJump With this option enabled, the map tracks when you pan +#' to another "copy" of the world and seamlessly jumps to the original +#' one so that all overlays like markers and vector layers are still visible. #' @param preferCanvas Whether leaflet.js Paths should be rendered on a Canvas renderer. #' @param ... other options used for leaflet.js map creation. #' @describeIn leaflet Options for map creation diff --git a/R/plugin-awesomeMarkers.R b/R/plugin-awesomeMarkers.R index a77a2601d..43cb47ceb 100644 --- a/R/plugin-awesomeMarkers.R +++ b/R/plugin-awesomeMarkers.R @@ -164,7 +164,7 @@ makeAwesomeIcon <- function( #' An icon can be represented as a list of the form `list(icon, library, #' ...)`. This function is vectorized over its arguments to create a list of #' icon data. Shorter argument values will be recycled. `NULL` values for -#' these arguments will be ignored. +#' these arguments will be ignored. #' @seealso #' @param icon Name of the icon #' @param library Which icon library. Default `"glyphicon"`, other possible @@ -175,15 +175,14 @@ makeAwesomeIcon <- function( #' `"cadetblue"`, `"white"`, `"gray"`, `"lightgray"`, `"black"` #' @param iconColor The color to use for the icon itself. Use any CSS-valid #' color (hex, rgba, etc.) or a named web color. -#' @param spin If `TRUE`, make the icon spin (only works when `library -#' = "fa"`) +#' @param spin If `TRUE`, make the icon spin (only works when `library = "fa"`) #' @param extraClasses Additional css classes to include on the icon. #' @return A list of awesome-icon data that can be passed to the `icon` #' @param squareMarker Whether to use a square marker. #' @param iconRotate Rotate the icon by a given angle. #' @param fontFamily Used when `text` option is specified. -#' @param text Use this text string instead of an icon. -#' argument of [addAwesomeMarkers()]. +#' @param text Use this text string instead of an icon. Argument of +#' [addAwesomeMarkers()]. #' @export awesomeIcons <- function( icon = "home", diff --git a/R/utils.R b/R/utils.R index 795f548bc..321a3aa82 100644 --- a/R/utils.R +++ b/R/utils.R @@ -7,14 +7,11 @@ #' Extension points for plugins #' -#' @param map a map object, as returned from [leaflet()] or -#' [leafletProxy()] +#' @param map a map object, as returned from [leaflet()] or [leafletProxy()] #' @param funcName the name of the function that the user called that caused #' this `dispatch` call; for error message purposes -#' @param leaflet an action to be performed if the map is from -#' [leaflet()] -#' @param leaflet_proxy an action to be performed if the map is from -#' [leafletProxy()] +#' @param leaflet an action to be performed if the map is from [leaflet()] +#' @param leaflet_proxy an action to be performed if the map is from [leafletProxy()]. #' #' @return `dispatch()` returns the value of `leaflet` or #' `leaflet_proxy()`, or an error. `invokeMethod()` returns the @@ -44,8 +41,7 @@ filterNULL <- function(x) { x[!unlist(lapply(x, is.null))] } -#' @param data a data object that will be used when evaluating formulas in -#' `...` +#' @param data a data object that will be used when evaluating formulas in `...` #' @param method the name of the JavaScript method to invoke #' @param ... unnamed arguments to be passed to the JavaScript method #' @rdname dispatch @@ -83,7 +79,7 @@ invokeMethod <- function(map, data, method, ...) { #' Creates a map-like object that can be used to customize and control a map #' that has already been rendered. For use in Shiny apps and Shiny docs only. #' -#' Normally, you create a Leaflet map using the [leaflet()] function. +#' Normally, you create a Leaflet map using [leaflet()]. #' This creates an in-memory representation of a map that you can customize #' using functions like [addPolygons()] and [setView()]. #' Such a map can be printed at the R console, included in an R Markdown @@ -94,7 +90,7 @@ invokeMethod <- function(map, data, method, ...) { #' map is long gone, and the user's web browser has already realized the Leaflet #' map instance. #' -#' This is where `leafletProxy` comes in. It returns an object that can +#' This is where `leafletProxy()` comes in. It returns an object that can #' stand in for the usual Leaflet map object. The usual map functions like #' [addPolygons()] and [setView()] can be called, and #' instead of customizing an in-memory representation, these commands will diff --git a/man/addLayersControl.Rd b/man/addLayersControl.Rd index 20248d6ba..2ca856fd0 100644 --- a/man/addLayersControl.Rd +++ b/man/addLayersControl.Rd @@ -29,8 +29,8 @@ most commonly used for mostly-opaque tile layers.} \item{overlayGroups}{character vector where each element is the name of a group. The user can turn each overlay group on or off independently.} -\item{position}{position of control: "topleft", "topright", "bottomleft", or -"bottomright"} +\item{position}{position of control: \code{"topleft"}, \code{"topright"}, +\code{"bottomleft"}, or \code{"bottomright"}.} \item{options}{a list of additional options, intended to be provided by a call to \code{layersControlOptions()}} diff --git a/man/addRasterImage.Rd b/man/addRasterImage.Rd index 1a69555e2..f2364792f 100644 --- a/man/addRasterImage.Rd +++ b/man/addRasterImage.Rd @@ -83,13 +83,13 @@ as in \code{x = spatSample(x, 100000, method="regular", as.raster=TRUE)}. With a \code{RasterLayer} you can use \code{\link[raster:sampleRegular]{raster::sampleRegular()}} as in \code{sampleRegular(x, 100000, asRaster=TRUE)}. -By default, the \code{addRasterImage} function will project the raster data +By default, \code{addRasterImage()} will project the raster data \code{x} to the Pseudo-Mercator projection (EPSG:3857). This can be a time-consuming operation for even moderately sized rasters; although it is much faster for SpatRasters than for RasterLayers. If you are repeatedly adding a particular raster to your Leaflet maps, you can perform the projection ahead of time using -\code{projectRasterForLeaflet()}, and call \code{addRasterImage} with +\code{projectRasterForLeaflet()}, and call \code{addRasterImage()} with \code{project = FALSE}. } \examples{ diff --git a/man/awesomeIcons.Rd b/man/awesomeIcons.Rd index 6ecc7356a..dd748cfd0 100644 --- a/man/awesomeIcons.Rd +++ b/man/awesomeIcons.Rd @@ -41,8 +41,8 @@ color (hex, rgba, etc.) or a named web color.} \item{fontFamily}{Used when \code{text} option is specified.} -\item{text}{Use this text string instead of an icon. -argument of \code{\link[=addAwesomeMarkers]{addAwesomeMarkers()}}.} +\item{text}{Use this text string instead of an icon. Argument of +\code{\link[=addAwesomeMarkers]{addAwesomeMarkers()}}.} } \value{ A list of awesome-icon data that can be passed to the \code{icon} diff --git a/man/colorNumeric.Rd b/man/colorNumeric.Rd index 253717995..1e488c2a5 100644 --- a/man/colorNumeric.Rd +++ b/man/colorNumeric.Rd @@ -87,10 +87,9 @@ to generate the bins and the breaks may not be "pretty".} \item{right}{parameter supplied to cut. See Details} \item{n}{Number of equal-size quantiles desired. For more precise control, -use the \code{probs} argument instead.} +use \code{probs} instead.} -\item{probs}{See \code{\link[stats:quantile]{stats::quantile()}}. If provided, the \code{n} -argument is ignored.} +\item{probs}{See \code{\link[stats:quantile]{stats::quantile()}}. If provided, \code{n} is ignored.} \item{levels}{An alternate way of specifying levels; if specified, domain is ignored} @@ -109,15 +108,14 @@ Conveniently maps data values (numeric or factor/character) to colors according to a given palette, which can be provided in a variety of formats. } \details{ -\code{colorNumeric} is a simple linear mapping from continuous numeric data +\code{colorNumeric()} is a simple linear mapping from continuous numeric data to an interpolated palette. -\code{colorBin} also maps continuous numeric data, but performs -binning based on value (see the \code{\link[base:cut]{base::cut()}} function). \code{colorBin} +\code{colorBin()} also maps continuous numeric data, but performs +binning based on value (see the \code{\link[base:cut]{base::cut()}} function). \code{colorBin()} defaults for the \code{\link[base:cut]{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]{stats::quantile()}} function. +\code{colorQuantile()} similarly bins numeric data, but via \code{\link[stats:quantile]{stats::quantile()}}. \code{colorFactor()} maps factors to colors. If the palette is discrete and has a different number of colors than the number of factors, diff --git a/man/dispatch.Rd b/man/dispatch.Rd index 5a2460152..6ba9ddbd6 100644 --- a/man/dispatch.Rd +++ b/man/dispatch.Rd @@ -15,20 +15,16 @@ dispatch( invokeMethod(map, data, method, ...) } \arguments{ -\item{map}{a map object, as returned from \code{\link[=leaflet]{leaflet()}} or -\code{\link[=leafletProxy]{leafletProxy()}}} +\item{map}{a map object, as returned from \code{\link[=leaflet]{leaflet()}} or \code{\link[=leafletProxy]{leafletProxy()}}} \item{funcName}{the name of the function that the user called that caused this \code{dispatch} call; for error message purposes} -\item{leaflet}{an action to be performed if the map is from -\code{\link[=leaflet]{leaflet()}}} +\item{leaflet}{an action to be performed if the map is from \code{\link[=leaflet]{leaflet()}}} -\item{leaflet_proxy}{an action to be performed if the map is from -\code{\link[=leafletProxy]{leafletProxy()}}} +\item{leaflet_proxy}{an action to be performed if the map is from \code{\link[=leafletProxy]{leafletProxy()}}.} -\item{data}{a data object that will be used when evaluating formulas in -\code{...}} +\item{data}{a data object that will be used when evaluating formulas in \code{...}} \item{method}{the name of the JavaScript method to invoke} diff --git a/man/leaflet.Rd b/man/leaflet.Rd index 6ba261d18..3527f035f 100644 --- a/man/leaflet.Rd +++ b/man/leaflet.Rd @@ -57,13 +57,15 @@ objects from the \pkg{sp} package that represent points, lines, or polygons.} \item{sizingPolicy}{htmlwidgets sizing policy object. Defaults to \code{\link[=leafletSizingPolicy]{leafletSizingPolicy()}}} -\item{minZoom}{Minimum zoom level of the map. Overrides any minZoom set on map layers.} +\item{minZoom}{Minimum zoom level of the map. Overrides any \code{minZoom} set on map layers.} -\item{maxZoom}{Maximum zoom level of the map. This overrides any maxZoom set on map layers.} +\item{maxZoom}{Maximum zoom level of the map. This overrides any \code{maxZoom} set on map layers.} \item{crs}{Coordinate Reference System to use. Don't change this if you're not sure what it means.} -\item{worldCopyJump}{With this option enabled, the map tracks when you pan to another "copy" of the world and seamlessly jumps to the original one so that all overlays like markers and vector layers are still visible.} +\item{worldCopyJump}{With this option enabled, the map tracks when you pan +to another "copy" of the world and seamlessly jumps to the original +one so that all overlays like markers and vector layers are still visible.} \item{preferCanvas}{Whether leaflet.js Paths should be rendered on a Canvas renderer.} diff --git a/man/leafletProxy.Rd b/man/leafletProxy.Rd index 09340071d..81f254d2e 100644 --- a/man/leafletProxy.Rd +++ b/man/leafletProxy.Rd @@ -32,7 +32,7 @@ Creates a map-like object that can be used to customize and control a map that has already been rendered. For use in Shiny apps and Shiny docs only. } \details{ -Normally, you create a Leaflet map using the \code{\link[=leaflet]{leaflet()}} function. +Normally, you create a Leaflet map using \code{\link[=leaflet]{leaflet()}}. This creates an in-memory representation of a map that you can customize using functions like \code{\link[=addPolygons]{addPolygons()}} and \code{\link[=setView]{setView()}}. Such a map can be printed at the R console, included in an R Markdown @@ -43,7 +43,7 @@ is rendered to an output. At this point, the in-memory representation of the map is long gone, and the user's web browser has already realized the Leaflet map instance. -This is where \code{leafletProxy} comes in. It returns an object that can +This is where \code{leafletProxy()} comes in. It returns an object that can stand in for the usual Leaflet map object. The usual map functions like \code{\link[=addPolygons]{addPolygons()}} and \code{\link[=setView]{setView()}} can be called, and instead of customizing an in-memory representation, these commands will diff --git a/man/leafletSizingPolicy.Rd b/man/leafletSizingPolicy.Rd index 1c47563bd..2d9001f0b 100644 --- a/man/leafletSizingPolicy.Rd +++ b/man/leafletSizingPolicy.Rd @@ -21,12 +21,49 @@ leafletSizingPolicy( \item{browser.fill}{defaults to \code{TRUE}} -\item{...}{all other arguments supplied to \code{\link[htmlwidgets:sizingPolicy]{htmlwidgets::sizingPolicy()}}} +\item{...}{ + Arguments passed on to \code{\link[htmlwidgets:sizingPolicy]{htmlwidgets::sizingPolicy}} + \describe{ + \item{\code{viewer.defaultWidth}}{The default width used to display the widget +within the RStudio Viewer.} + \item{\code{viewer.defaultHeight}}{The default height used to display the widget +within the RStudio Viewer.} + \item{\code{viewer.padding}}{Padding around the widget when displayed in the RStudio +Viewer (defaults to 15 pixels).} + \item{\code{viewer.fill}}{When displayed in the RStudio Viewer, automatically size +the widget to the viewer dimensions (note that \code{viewer.padding} is +still applied). Default to \code{TRUE}.} + \item{\code{viewer.suppress}}{Never display the widget within the RStudio Viewer +(useful for widgets that require a large amount of space for rendering). +Defaults to \code{FALSE}.} + \item{\code{viewer.paneHeight}}{Request that the RStudio Viewer be forced to a +specific height when displaying this widget.} + \item{\code{browser.defaultWidth}}{The default width used to display the widget +within a standalone web browser.} + \item{\code{browser.defaultHeight}}{The default height used to display the widget +within a standalone web browser.} + \item{\code{browser.padding}}{Padding around the widget when displayed in a +standalone browser (defaults to 40 pixels).} + \item{\code{browser.external}}{When displaying in a browser, always use an external +browser (via \code{\link[=browseURL]{browseURL()}}). Defaults to `FALSE``, which will +result in the use of an internal browser within RStudio v1.1 and higher.} + \item{\code{knitr.defaultWidth}}{The default width used to display the widget within +documents generated by knitr (e.g. R Markdown).} + \item{\code{knitr.defaultHeight}}{The default height used to display the widget +within documents generated by knitr (e.g. R Markdown).} + \item{\code{knitr.figure}}{Apply the default knitr fig.width and fig.height to the +widget when it's rendered within R Markdown documents. Defaults to +\code{TRUE}.} + \item{\code{fill}}{Whether or not the widget's container should be treated as a fill +item, meaning that its \code{height} is allowed to grow/shrink to fit a fill +container with an opinionated height (see \code{\link[htmltools:bindFillRole]{htmltools::bindFillRole()}} for +more). Examples of fill containers include \code{bslib::card()} and +\code{bslib::card_body_fill()}.} + }} } \value{ An \code{htmlwidgets::sizingPolicy} object } \description{ Sizing policy used withing leaflet htmlwidgets. -All arguments are passed directly to \code{\link[htmlwidgets:sizingPolicy]{htmlwidgets::sizingPolicy()}} } diff --git a/man/makeAwesomeIcon.Rd b/man/makeAwesomeIcon.Rd index 711e46600..ce92b33ff 100644 --- a/man/makeAwesomeIcon.Rd +++ b/man/makeAwesomeIcon.Rd @@ -41,8 +41,8 @@ color (hex, rgba, etc.) or a named web color.} \item{fontFamily}{Used when \code{text} option is specified.} -\item{text}{Use this text string instead of an icon. -argument of \code{\link[=addAwesomeMarkers]{addAwesomeMarkers()}}.} +\item{text}{Use this text string instead of an icon. Argument of +\code{\link[=addAwesomeMarkers]{addAwesomeMarkers()}}.} } \description{ Make Awesome Icon diff --git a/man/map-layers.Rd b/man/map-layers.Rd index 2dd250760..37a6697a9 100644 --- a/man/map-layers.Rd +++ b/man/map-layers.Rd @@ -272,8 +272,8 @@ addTopoJSON( \item{html}{the content of the control. May be provided as string or as HTML generated with Shiny/htmltools tags} -\item{position}{position of control: "topleft", "topright", "bottomleft", or -"bottomright"} +\item{position}{position of control: \code{"topleft"}, \code{"topright"}, +\code{"bottomleft"}, or \code{"bottomright"}.} \item{layerId}{the layer id} diff --git a/man/map-options.Rd b/man/map-options.Rd index 97b2235d5..a5a28c15a 100644 --- a/man/map-options.Rd +++ b/man/map-options.Rd @@ -140,7 +140,7 @@ transparency} \item{interactive}{whether the element emits mouse events} -\item{clickable}{DEPRECATED! Use the \code{interactive} option.} +\item{clickable}{DEPRECATED! Use the \code{interactive} argument.} \item{noHide, direction, offset, permanent}{label options; see \url{https://web.archive.org/web/20220702182250/https://leafletjs.com/reference-1.3.4.html#tooltip-option}}