new_dataset_from_auto: New dataset from automatic calculations

View source: R/class_Dataset.R

new_dataset_from_autoR Documentation

New dataset from automatic calculations

Description

Create a new Dataset object by automatically calculating all metadata from the underlying data. This function is useful when pre-calculated metadata are not available. Note this function will take longer to create variables than other functions because it requires performing geospatial operations.

Usage

new_dataset_from_auto(x, id = uuid::UUIDgenerate())

Arguments

x

sf::st_sf() or a combined terra::rast() object.

id

character unique identifier. Defaults to a random identifier (uuid::UUIDgenerate()).

Details

Create a new Dataset object.

Value

A Dataset object.

Examples

# find example data
f <- system.file(
  "extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
  package = "wheretowork"
)

# import data
r <- suppressWarnings(terra::rast(f))
r <- c(r, r * 2, r * 3, r * 4)
names(r) <- c("r1", "r2", "r3", "r4")

# create new dataset
d <- new_dataset_from_auto(r)

# print object
print(d)

NCC-CNC/wheretowork documentation built on Feb. 27, 2025, 6:11 p.m.