A simple function that selects every "n" rows in a data frame to create a new data frame object. Effectively "thins" large datasets.

subsample(df, n = 5, random_start = FALSE, plot = TRUE)

Arguments

df

data frame. The data to process.

n

numeric. This will prompt the function to extract every "n" rows.

random_start

logical. Defaults to FALSE. If TRUE, randomises the start row of the data.

plot

logical. Defaults to TRUE. Plots the data automatically.

Value

A data frame object.

Examples

# Subsample every 10 rows: data("squid.rd")
#> Warning: data set ‘squid.rd’ not found
subsample(squid.rd, n = 10)
#> Error in subsample(squid.rd, n = 10): could not find function "subsample"
# Subsample with random first value: data("sardine.rd")
#> Warning: data set ‘sardine.rd’ not found
subsample(sardine.rd, 3, TRUE)
#> Error in subsample(sardine.rd, 3, TRUE): could not find function "subsample"