Dataset class

Dataset class

Details

Definition for the Dataset class.

Note that this method has no effect if the dataset does not have file path on disk.

See also

Public fields

id

character identifier.

spatial_path

character file path.

attribute_path

character file path.

boundary_path

character file path.

spatial_data

NULL, sf::st_sf(), or raster::raster() object.

attribute_data

NULL, or tibble::tibble() object.

boundary_data

NULL, or Matrix::sparseMatrix() or NA object.

Methods

Public methods


Method new()

Create a Dataset object.

Usage

Dataset$new(
  id,
  spatial_path,
  attribute_path,
  boundary_path,
  spatial_data,
  attribute_data,
  boundary_data
)

Arguments

id

character value.

spatial_path

character file path.

attribute_path

character file path.

boundary_path

character file path.

spatial_data

sf::st_sf(), or raster::raster() object.

attribute_data

tibble::tibble() object.

boundary_data

Matrix::sparseMatrix() object or NA.

Returns

A new Dataset object.

Method new()

Create a Dataset object.

Usage

Dataset$new(
  id,
  spatial_path,
  attribute_path,
  boundary_path,
  spatial_data,
  attribute_data,
  boundary_data
)

Arguments

id

character value.

spatial_path

character file path.

attribute_path

character file path.

boundary_path

character file path.

spatial_data

sf::st_sf(), or raster::raster() object.

attribute_data

tibble::tibble() object.

boundary_data

Matrix::sparseMatrix() object or NA.

Returns

A new Dataset object.


Method print()

Print the object.

Usage

Dataset$print(...)

Arguments

...

not used.

Method print()

Print the object.

Usage

Dataset$print(...)

Arguments

...

not used.


Method repr()

Generate a character summarizing the representation of the object.

Usage

Dataset$repr()

Returns

character value.

Method repr()

Generate a character summarizing the representation of the object.

Usage

Dataset$repr()

Returns

character value.


Method import()

Import the data into memory.

Usage

Dataset$import()

Method import()

Import the data into memory.

Usage

Dataset$import()


Method write()

Write the data to disk.

Usage

Dataset$write(spatial_path, attribute_path, boundary_path)

Arguments

spatial_path

character file path.

attribute_path

character file path.

boundary_path

character file path.

Method write()

Write the data to disk.

Usage

Dataset$write(spatial_path, attribute_path, boundary_path)

Arguments

spatial_path

character file path.

attribute_path

character file path.

boundary_path

character file path.


Method clean()

Clean the dataset from memory.

Usage

Dataset$clean()

Method clean()

Clean the dataset from memory.

Usage

Dataset$clean()


Method get_spatial_data()

Get the spatial data.

Usage

Dataset$get_spatial_data()

Returns

sf::st_as_sf() or raster::raster() object.

Method get_spatial_data()

Get the spatial data.

Usage

Dataset$get_spatial_data()

Returns

sf::st_as_sf() or raster::raster() object.


Method get_attribute_data()

Get the attribute data.

Usage

Dataset$get_attribute_data()

Returns

tibble::tibble() object.

Method get_attribute_data()

Get the attribute data.

Usage

Dataset$get_attribute_data()

Returns

tibble::tibble() object.


Method get_boundary_data()

Get the spatial data.

Usage

Dataset$get_boundary_data()

Returns

Matrix::sparseMatrix() object.

Method get_boundary_data()

Get the spatial data.

Usage

Dataset$get_boundary_data()

Returns

Matrix::sparseMatrix() object.


Method get_crs()

Get the coordinate reference system.

Usage

Dataset$get_crs()

Returns

sf::st_crs() object.

Method get_crs()

Get the coordinate reference system.

Usage

Dataset$get_crs()

Returns

sf::st_crs() object.


Method get_bbox()

Get the bounding box.

Usage

Dataset$get_bbox(native = TRUE, expand = FALSE)

Arguments

native

logical indicating if the bounding box should be in (TRUE) the native coordinate reference system or (FALSE) re-projected to longitude/latitude?

expand

FALSE should the bounding box be expanded by 10%?

Returns

list object with "xmin", "xmax", "ymin", and "ymax" elements.

Method get_bbox()

Get the bounding box.

Usage

Dataset$get_bbox(native = TRUE, expand = FALSE)

Arguments

native

logical indicating if the bounding box should be in (TRUE) the native coordinate reference system or (FALSE) re-projected to longitude/latitude?

expand

FALSE should the bounding box be expanded by 10%?

Returns

list object with "xmin", "xmax", "ymin", and "ymax" elements.


Method get_planning_unit_indices()

Get planning unit indices.

Usage

Dataset$get_planning_unit_indices()

Returns

integer vector of indices.

Method get_planning_unit_indices()

Get planning unit indices.

Usage

Dataset$get_planning_unit_indices()

Returns

integer vector of indices.


Method get_names()

Get attribute names.

Usage

Dataset$get_names()

Returns

character vector of field/layer names.

Method get_names()

Get attribute names.

Usage

Dataset$get_names()

Returns

character vector of field/layer names.


Method get_planning_unit_areas()

Get area values.

Usage

Dataset$get_planning_unit_areas()

Returns

numeric vector of values.

Method get_planning_unit_areas()

Get area values.

Usage

Dataset$get_planning_unit_areas()

Returns

numeric vector of values.


Method get_index()

Get a data from the dataset at an index.

Usage

Dataset$get_index(index)

Arguments

index

character or integer indicating the field/layer with the data.

Returns

sf::st_as_sf() or raster::raster() object.

Method get_index()

Get a data from the dataset at an index.

Usage

Dataset$get_index(index)

Arguments

index

character or integer indicating the field/layer with the data.

Returns

sf::st_as_sf() or raster::raster() object.


Method has_index()

Check if the dataset has an index.

Usage

Dataset$has_index(index)

Arguments

index

character or integer indicating the field/layer with the data.

Returns

logical indicating if data is present or not.

Method has_index()

Check if the dataset has an index.

Usage

Dataset$has_index(index)

Arguments

index

character or integer indicating the field/layer with the data.

Returns

logical indicating if data is present or not.


Method max_index()

Maximum index.

Usage

Dataset$max_index()

Returns

integer largest index.

Method max_index()

Maximum index.

Usage

Dataset$max_index()

Returns

integer largest index.


Method add_index()

Add data at an index.

Usage

Dataset$add_index(index, values)

Arguments

index

character or integer indicating the field/layer with the data.

values

numeric vector.

Method add_index()

Add data at an index.

Usage

Dataset$add_index(index, values)

Arguments

index

character or integer indicating the field/layer with the data.

values

numeric vector.


Method clone()

The objects of this class are cloneable with this method.

Usage

Dataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Method clone()

The objects of this class are cloneable with this method.

Usage

Dataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.