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)
df | data frame. The data to process. |
---|---|
n | numeric. This will prompt the function to extract every " |
random_start | logical. Defaults to FALSE. If TRUE, randomises the start row of the data. |
plot | logical. Defaults to TRUE. Plots the data automatically. |
A data frame object.
#> Warning: data set ‘squid.rd’ not foundsubsample(squid.rd, n = 10)#> Error in subsample(squid.rd, n = 10): could not find function "subsample"#> Warning: data set ‘sardine.rd’ not foundsubsample(sardine.rd, 3, TRUE)#> Error in subsample(sardine.rd, 3, TRUE): could not find function "subsample"