Learn R Programming

sits (version 1.12.0)

sits_sample: Sample a percentage of a time series

Description

Takes a sits tibble with different labels and returns a new tibble. For a given field as a group criterion, this new tibble contains a given number or percentage of the total number of samples per group. Parameter n indicantes the number of random samples with reposition. Parameter frac indicates a fraction of random samples without reposition. If frac > 1, no sampling is done.

Usage

sits_sample(data.tb, n = NULL, frac = NULL)

Arguments

data.tb

Input sits tibble.

n

Number of samples to pick from each group of data.

frac

Percentage of samples to pick from each group of data.

Value

A sits tibble with a fixed quantity of samples of informed labels and all other.

Examples

Run this code
# NOT RUN {
# Retrieve a set of time series with 2 classes
data(cerrado_2classes)
# Print the labels of the resulting tibble
sits_labels(cerrado_2classes)
# Samples the data set
data.tb <- sits_sample(cerrado_2classes, n = 10)
# Print the labels of the resulting tibble
sits_labels(data.tb)
# }

Run the code above in your browser using DataLab