Skip to content

Commit

Permalink
custom documentation for name, command, and pattern params
Browse files Browse the repository at this point in the history
  • Loading branch information
Aariq committed Oct 22, 2024
1 parent 03bc3d0 commit 3900355
Show file tree
Hide file tree
Showing 11 changed files with 179 additions and 224 deletions.
9 changes: 7 additions & 2 deletions R/tar-stars.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#' Create a stars _stars_ Target
#'
#' Provides a target format for stars objects.
#'
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param command R code to run the target.
#' @param pattern Code to define a dynamic branching pattern for a target. See
#' [targets::tar_target()] for more information
#' @param driver character. File format expressed as GDAL driver names passed to [stars::write_stars()]. See [sf::st_drivers()].
#' @param options character. GDAL driver specific datasource creation options passed to [stars::write_stars()]
#' @param proxy logical. Passed to [stars::read_stars()]. If `TRUE` the target will be read as an object of class `stars_proxy`. Otherwise, the object is class `stars`.
Expand All @@ -14,7 +19,7 @@
#' @note The `iteration` argument is unavailable because it is hard-coded to
#' `"list"`, the only option that works currently.
#'
#' @seealso [targets::tar_target_raw()]
#' @seealso [targets::tar_target()]
#' @export
#' @examplesIf rlang::is_installed("stars")
#' if (Sys.getenv("TAR_LONG_EXAMPLES") == "true") {
Expand Down
20 changes: 18 additions & 2 deletions R/tar-terra-rast.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
#'
#' Provides a target format for [terra::SpatRaster-class] objects.
#'
#' @details
#' [terra::SpatRaster-class] objects do not contain raster data directly—they
#' contain a C++ pointer to memory where the data is stored. As a result, these
#' objects are not portable between R sessions without special handling, which
#' causes problems when including them in `targets` pipelines with
#' `tar_target()`. `tar_terra_rast()` handles this issue by writing and reading
#' the target as a geospatial file (specified by `filetype`) rather than saving
#' the `SpatRaster` object itself.
#'
#'
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param command R code to run the target.
#' @param pattern Code to define a dynamic branching pattern for a target. See
#' [targets::tar_target()] for more information
#' @param filetype character. File format expressed as GDAL driver names passed
#' to [terra::writeRaster()]
#' @param gdal character. GDAL driver specific datasource creation options
#' @param gdal character. GDAL driver specific data source creation options
#' passed to [terra::writeRaster()]
#' @param ... Additional arguments not yet used
#'
Expand All @@ -15,7 +31,7 @@
#'
#' @returns target class "tar_stem" for use in a target pipeline
#' @importFrom rlang %||% arg_match0
#' @seealso [targets::tar_target_raw()]
#' @seealso [targets::tar_target()]
#' @export
#' @examples
#' if (Sys.getenv("TAR_LONG_EXAMPLES") == "true") {
Expand Down
12 changes: 12 additions & 0 deletions R/tar-terra-sprc.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#' Provides a target format for [terra::SpatRasterCollection] objects,
#' which have no restriction in the extent or other geometric parameters.
#'
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param command R code to run the target.
#' @param pattern Code to define a dynamic branching pattern for a target. See
#' [targets::tar_target()] for more information
#' @param filetype character. File format expressed as GDAL driver names passed
#' to [terra::writeRaster()]
#' @param gdal character. GDAL driver specific datasource creation options
Expand Down Expand Up @@ -124,6 +130,12 @@ tar_terra_sprc <- function(name,
#' Provides a target format for [terra::SpatRasterDataset] objects,
#' which hold sub-datasets, each a `SpatRaster` that can have multiple layers.
#'
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param command R code to run the target.
#' @param pattern Code to define a dynamic branching pattern for a target. See
#' [targets::tar_target()] for more information
#' @param filetype character. File format expressed as GDAL driver names passed
#' to [terra::writeRaster()]
#' @param gdal character. GDAL driver specific datasource creation options
Expand Down
15 changes: 15 additions & 0 deletions R/tar-terra-vect.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
#'
#' Provides a target format for [terra::SpatVector-class] objects.
#'
#' @details
#' [terra::SpatVector-class] objects do not contain vector data directly—they
#' contain a C++ pointer to memory where the data is stored. As a result, these
#' objects are not portable between R sessions without special handling, which
#' causes problems when including them in `targets` pipelines with
#' `tar_target()`. `tar_terra_rast()` handles this issue by writing and reading
#' the target as a geospatial file (specified by `filetype`) rather than saving
#' the `SpatVector` object itself.
#'
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param command R code to run the target.
#' @param pattern Code to define a dynamic branching pattern for a target. See
#' [targets::tar_target()] for more information
#' @param filetype character. File format expressed as GDAL driver names passed
#' to [terra::writeVector()]. See 'Note' for more details
#' @param gdal character. GDAL driver specific datasource creation options
Expand Down
8 changes: 5 additions & 3 deletions R/tar_terra_tiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
#'
#' This target factory is useful when a raster is too large or too high
#' resolution to work on in-memory. It can instead be split into tiles that can
#' be iterated over, potentially using parallel workers.
#'
#' be iterated over using dynamic branching.
#' @param name Symbol, name of the target. A target
#' name must be a valid name for a symbol in R, and it
#' must not start with a dot. See [targets::tar_target()] for more information.
#' @param raster a `SpatRaster` object to be split into tiles
#' @param tile_fun a helper function that returns a list of numeric vectors such as [tile_grid] or [tile_blocksize] specified in one of the following ways:
#' - A named function, e.g. `tile_blocksize` or `"tile_blocksize"`
Expand All @@ -24,7 +26,7 @@
#' extents and a downstream pattern that maps over these extents to create a
#' list of SpatRaster objects.
#'
#' @seealso [tile_grid()], [tile_blocksize()], [tar_terra_rast()]
#' @seealso [tile_n()], [tile_grid()], [tile_blocksize()], [tar_terra_rast()]
#' @export
#'
#' @examples
Expand Down
57 changes: 18 additions & 39 deletions man/tar_stars.Rd

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

68 changes: 28 additions & 40 deletions man/tar_terra_rast.Rd

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

55 changes: 17 additions & 38 deletions man/tar_terra_sds.Rd

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

Loading

0 comments on commit 3900355

Please sign in to comment.