Create a new Variable object.
new_variable(
dataset,
index,
units,
total,
legend,
provenance = new_provenance_from_source("missing")
)
dataset |
|
---|---|
index |
|
units |
|
total |
|
legend |
|
provenance | Provenance object.
Defaults to |
A Variable object.
# 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)
# create new variable
v <- new_variable(d,
index = 1, total = 12, units = "ha",
legend = new_continuous_legend(1, 100, c("#000000", "#AAAAAA"))
)
# print object
print(v)
#> Variable
#> dataset: .../sim_raster_spatial.tif
#> index: Brown_necked_Parrot_Brown_necked_
#> total: 12
#> units: ha
#> provenance: missing