Skip to contents

Create a new Dataset object.

Usage

new_dataset(
  spatial_path,
  attribute_path,
  boundary_path,
  spatial_data = NULL,
  attribute_data = NULL,
  boundary_data = NULL,
  id = uuid::UUIDgenerate()
)

Arguments

spatial_path

character file path for spatial data.

attribute_path

character file path for attribute data.

boundary_path

character file path for boundary data.

spatial_data

NULL, sf::st_sf(), or terra::rast() object. Defaults to NULL such that data are automatically imported using the argument to spatial_path.

attribute_data

NULL, or tibble::tibble() object. Defaults to NULL such that data are automatically imported using the argument to attribute_path.

boundary_data

NULL, or Matrix::sparseMatrix() object. Defaults to NULL such that data are automatically imported using the argument to boundary_path.

id

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

Value

A Dataset object.

Examples

# find data file paths
f1 <- system.file(
  "extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
  package = "wheretowork"
)
f2 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_attribute.csv.gz",
  package = "wheretowork"
)
f3 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_boundary.csv.gz",
  package = "wheretowork"
)

# create new dataset
d <- new_dataset(f1, f2, f3)

# print object
print(d)
#> Dataset
#>   paths:
#>     spatial: C:/Users/Daniel Wismer/AppData/Local/Temp/Rtmpchjhef/temp_libpath6006e153c6b/wheretowork/extdata/projects/sim_raster/sim_raster_spatial.tif
#>     attribute: C:/Users/Daniel Wismer/AppData/Local/Temp/Rtmpchjhef/temp_libpath6006e153c6b/wheretowork/extdata/projects/sim_raster/sim_raster_attribute.csv.gz
#>     boundary: C:/Users/Daniel Wismer/AppData/Local/Temp/Rtmpchjhef/temp_libpath6006e153c6b/wheretowork/extdata/projects/sim_raster/sim_raster_boundary.csv.gz