Subsamples a specified number of observations from a BirdNET output dataset. Supports four subsampling methods: proportional stratified by confidence score, random, or top confidence scores. Optionally saves the subsampled data to a CSV file.
Usage
birdnet_subsample(
data,
n,
method = c("even_stratified", "proportional_stratified", "random", "top"),
save_to_file = FALSE,
file = NULL
)
Arguments
- data
A data frame containing BirdNET output.
- n
Integer. Number of observations to subsample.
- method
Character. Subsampling method to use. One of:
- "proportional_stratified"
Samples proportionally across confidence score strata.
- "even_stratified"
Samples evenly across confidence score strata.
- "random"
Randomly samples
n
observations per species.- "top"
Selects the top
n
observations with the highest confidence per species.
Defaults to
"proportional_stratified"
.- save_to_file
Logical. If
TRUE
, saves the output to a CSV file. Defaults toFALSE
. Automatically set toTRUE
iffile
is provided.- file
Character or
NULL
. File path to save the output CSV. IfNULL
andsave_to_file = TRUE
, saves as"subsampled_data.csv"
in the working directory.