Learn R Programming

sits (version 0.10.0)

sits_relabel: Relabels a sits tibble

Description

Given a sits tibble with a set of labels, and a conversion list between the original labels and new labels, returns a new sits tibble whose labels are changed.

Usage

sits_relabel(data, conv_lst)

Arguments

data

A sits tibble.

conv_lst

A named list used to convert labels to a new value. Actual labels must be the names of the list elements. An empty list produces no difference.

Value

A new sits tibble with modified labels.

Examples

Run this code
# NOT RUN {
# Read a set of time series with information on deforestation
data(samples_mt_4bands)
# Print the labels
sits_labels(samples_mt_4bands)
# Create a conversion list.
# Three classes will be converted to "Cropland".
conv_lst <- list(
    Soy_Corn = "Cropland",
    Soy_Cotton = "Cropland",
    Soy_Fallow = "Cropland",
    Soy_Millet = "Cropland",
    Soy_Sunflower = "Cropland",
    Fallow_Cotton = "Cropland"
)
# relabel the data
new_data <- sits_relabel(samples_mt_4bands, conv_lst)
# show the new labels
sits_labels(new_data)
# }

Run the code above in your browser using DataLab