This casts a data.frame
or sf
object into an object of class
sspm_dataset
. This object is the format the package
uses to manage and manipulate the modeling data.
spm_as_dataset(data, name, time, uniqueID, coords = NULL, ...)
# S4 method for data.frame,ANY,ANY,ANY,missingOrNULL
spm_as_dataset(
data,
name,
time,
uniqueID,
coords,
crs = NULL,
boundaries = NULL,
biomass = NULL,
density = NULL,
biomass_units = NULL,
density_units = NULL
)
# S4 method for data.frame,ANY,ANY,ANY,list
spm_as_dataset(
data,
name,
time,
uniqueID,
coords,
crs = NULL,
boundaries = NULL,
biomass = NULL,
density = NULL,
biomass_units = "kg",
density_units = "kg/km^2"
)
# S4 method for data.frame,ANY,ANY,ANY,character
spm_as_dataset(
data,
name,
time,
uniqueID,
coords,
crs = NULL,
boundaries = NULL,
biomass = NULL,
density = NULL,
biomass_units = "kg",
density_units = "kg/km^2"
)
# S4 method for sf,ANY,ANY,ANY,ANY
spm_as_dataset(
data,
name,
time,
uniqueID,
coords,
crs = NULL,
boundaries = NULL,
biomass = NULL,
density = NULL,
biomass_units = "kg",
density_units = "kg/km^2"
)
[data.frame OR sf] The dataset.
[character] The name of the dataset, default to "Biomass".
[character] The column of data
for the temporal
dimensions (i.e. year).
[character] The column of data
that is unique for all
rows of the data matrix.
[character] The column of data
for longitude and
latitude of the observations.
Arguments passed onto methods.
Coordinate reference system, passed onto st_as_sf.
[sspm_boundary] An object of class sspm_discrete_boundary.
[character] Columns to be encoded as biomasses (required).
[character] Columns to be encoded as densities (optionnal).
[character] Units for biomass columns, default to "kg".
[character] Units for density columns, default to "kg/km^2".
An object of class sspm_dataset
.
data(borealis_simulated, package = "sspm")
biomass_dataset <- spm_as_dataset(borealis_simulated, name = "borealis",
density = "weight_per_km2",
time = "year_f",
coords = c('lon_dec','lat_dec'),
uniqueID = "uniqueID")
#> ℹ Casting data matrix into simple feature collection using columns: lon_dec, lat_dec
#> ! Warning: sspm is assuming WGS 84 CRS is to be used for casting
biomass_dataset
#>
#> ‒‒ Dataset borealis ‒‒
#> → [1800 rows, 9 columns]
#> → Density : weight_per_km2
#> → Time : year_f
#>