View source: R/iucnn_prepare_labels.R
iucnn_prepare_labels | R Documentation |
Converting IUCN category labels into numeric categories required by
iucnn_train_model
.
iucnn_prepare_labels(
x,
y,
species = "species",
labels = "labels",
accepted_labels = c("LC", "NT", "VU", "EN", "CR"),
level = "detail",
threatened = c("CR", "EN", "VU")
)
x |
a data.frame or a list. If a data.frame,
two columns with the species names and IUCN categories
respectively. The column names are defined by the
species and labels arguments. If a list, expecting
the format as returned by |
y |
object of class |
species |
a character string. The name of the column with the species names in x. |
labels |
a character string. The name of the column with the labels (assessment categories) in x. |
accepted_labels |
a character string. The labels to be converted in to numeric values. Entries with labels not mentioned (e.g. "DD") will be removed. The numeric labels returned by the function will correspond to the order in this argument. For instance with default settings, LC -> 0, CR -> 4. |
level |
a character string. The level of output level detail. If "detail" full IUCN categories, if "broad" then 0 = Not threatened, and 1 = Threatened. |
threatened |
a character string. Only if level=="broad", Which labels to consider threatened. |
a data.frame with species names and numeric labels
See vignette("Approximate_IUCN_Red_List_assessments_with_IUCNN")
for a tutorial on how to run IUCNN.
## Not run:
dat <- data.frame(species = c("A", "B"),
decimallongitude = runif(200, 10, 15),
decimallatitude = runif(200, -5, 5))
labs <- data.frame(species = c("A", "B"),
labels = c("CR", "LC"))
features <- iucnn_prepare_features(dat,
type = "geographic")
iucnn_prepare_labels(x = labs,
y = features)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.