Skip to content

Commit

Permalink
added documentation and some examples for tar_terra_rast/vect
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed Mar 12, 2024
1 parent 51d6ef9 commit e350ee5
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(tar_terra_rast)
export(tar_terra_vect)
importFrom(utils,globalVariables)
24 changes: 23 additions & 1 deletion R/tar-terra-rast.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
#' Targets format for terra rasters
#'
#' Provides targets format for `terra::rast`
#'
#' @inheritParams targets::tar_target
#'
#' @export
#' @examples
#' if (Sys.getenv("TAR_LONG_EXAMPLES") == "true") {
#' targets::tar_dir({ # tar_dir() runs code from a temporary directory.
#' library(geotargets)
#' targets::tar_script({
#' list(
#' geotargets::tar_terra_rast(
#' test,
#' system.file("ex/elev.tif", package="terra") |> terra::rast()
#' )
#' )
#' })
#' targets::tar_make()
#' x <- targets::tar_read(test)
#' })
#' }
tar_terra_rast <- function(name,
command,
pattern = NULL,
packages = targets::tar_option_get("packages"),
tidy_eval = targets::tar_option_get("tidy_eval"),
packages = targets::tar_option_get("packages"),
library = targets::tar_option_get("library"),
repository = targets::tar_option_get("repository"),
iteration = targets::tar_option_get("iteration"),
Expand Down
7 changes: 7 additions & 0 deletions R/tar-terra-vect.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ format_terra_vect_shapefile <- targets::tar_format(
unmarshal = function(object) terra::unwrap(object)
)

#' Targets format for terra vectors
#'
#' Provides targets format for `terra::vect` objects
#'
#' @inheritParams targets::tar_target
#'
#' @export
tar_terra_vect <- function(name,
command,
pattern = NULL,
Expand Down
228 changes: 228 additions & 0 deletions man/tar_terra_rast.Rd

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

Loading

0 comments on commit e350ee5

Please sign in to comment.