View source: R/class_Variable.R
new_variable_from_auto | R Documentation |
Create a new Variable 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.
new_variable_from_auto(
dataset,
index,
units = "",
type = "auto",
colors = "random",
provenance = "missing",
labels = "missing",
hidden = FALSE
)
dataset |
|
index |
|
units |
|
type |
|
colors |
|
provenance |
|
labels |
|
|
The argument to colors
can be a vector of different colors
(in hexadecimal format, e.g. "#112233"), or a single
charactercontaining the name of a color palette that is used to generate a vector of different colors (see [color_palette()] for more information). The color palette name
"random"' is also available, such that
colors are generated using a randomly selected palette.
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_from_auto(d, index = 1)
# print object
print(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.