var_labels | R Documentation |
Generate pretty labels (in the form of an expression) that can be used for plotting
var_labels(x, dataset, with_units = TRUE, abbreviated = FALSE)
x |
either a character vector with the names of the variables, or a
[region_slice())]: R:region_slice()) |
dataset |
string defining dataset to be downloaded (a list of possible
values can be obtained with |
with_units |
boolean defining whether the label should include units |
abbreviated |
boolean defining whether the label should use abbreviations for the variable |
a expression that can be used as a label in plots
var_labels("bio01", dataset = "Example")
# set the data_path for this example to run on CRAN
# users don't need to run this line
set_data_path(on_CRAN = TRUE)
# for a SpatRaster
climate_20k <- region_slice(
time_bp = -20000,
bio_variables = c("bio01", "bio10", "bio12"),
dataset = "Example"
)
terra::plot(climate_20k, main = var_labels(climate_20k, dataset = "Example"))
terra::plot(climate_20k, main = var_labels(climate_20k,
dataset = "Example",
abbreviated = TRUE
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.