sits_sample: Sample a percentage of a time series

View source: R/sits_sample_functions.R

sits_sampleR Documentation

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 percentage of the total number of samples per group. If frac > 1 , all sampling will be done with replacement.

Usage

sits_sample(data, frac = 0.2, oversample = TRUE)

Arguments

data

Sits time series tibble (class = "sits")

frac

Percentage of samples to extract (range: 0.0 to 2.0, default = 0.2)

oversample

Logical: oversample classes with small number of samples? (TRUE/FALSE)

Value

A sits tibble with a fixed quantity of samples.

Author(s)

Rolf Simoes, rolf.simoes@inpe.br

Examples

# Retrieve a set of time series with 2 classes
data(cerrado_2classes)
# Print the labels of the resulting tibble
summary(cerrado_2classes)
# Sample by fraction
data_02 <- sits_sample(cerrado_2classes, frac = 0.2)
# Print the labels
summary(data_02)

sits documentation built on Nov. 2, 2023, 5:59 p.m.