birdnet_gather: Gather BirdNET results

View source: R/birdnet_gather.R

birdnet_gatherR Documentation

Gather BirdNET results

Description

Gather all BirdNET results from a desired folder into one user-friendly data.table / data.frame.

Usage

birdnet_gather(results.directory, formatted = TRUE)

Arguments

results.directory

Path to directory where raw csv or txt BirdNET results using rtype = "r" have been stored.

formatted

Logical indicating whether to gather formatted (see birdnet_format) or unformatted (raw) BirdNET results. Default = TRUE. When FALSE, the function will gather only unformatted (raw) results.

Details

This function was developed by the National Park Service Natural Sounds and Night Skies Division to gather results produced by BirdNET. It uses the data.table function fread for much faster reading of many csv or txt files.

Value

Returns a data.frame/data.table.

If formatted = TRUE:

  • recordingID: Recording identifier for the file, e.g., SITE_YYYYMMDD_HHMMSS.wav.

  • filepath: Filepath for the processed audio file.

  • start: Start time of detection in seconds.

  • end: End time of detection in seconds.

  • scientific_name: Species scientific name.

  • common_name: Species common name.

  • confidence: BirdNET's confidence level in this detection ranging from 0 (least confident) to 1 (most confident).

  • lat: Latitude input used.

  • long: Longitude input used.

  • week: Week of year.

  • overlap: Overlap input used.

  • sensitivity: Sensitivity input used.

  • min_conf: Minimum confidence input used.

  • species_list: Species list used.

  • model: BirdNET model used.

  • verify: A column into which verifications may be populated. When initially created, will be 'NA'.

  • timezone: Timezone setting used in the audio recorder.

When formatted = FALSE, it returns the same columns without the recordingID, verify, and timezone columns.

See Also

birdnet_analyzer, birdnet_verify, birdnet_format

Examples

## Not run: 

# Create a BirdNET results directory for this example
dir.create('example-results-directory')

# Write examples of formatted BirdNET outputs to example results directory
data(exampleFormatted1)
write.table(
   x = exampleFormatted1,
   file = 'example-results-directory/Rivendell_20210623_113602.BirdNET_formatted_results.csv',
   row.names = FALSE, quote = FALSE, sep = ','
)

data(exampleFormatted2)
write.table(
   x = exampleFormatted2,
   file = 'example-results-directory/Rivendell_20210623_114602.BirdNET_formatted_results.csv',
   row.names = FALSE, quote = FALSE, sep = ','
)

# Write examples of raw BirdNET outputs to example results directory
data(exampleBirdNET1)
write.table(
   x = exampleBirdNET1,
   file = 'example-results-directory/Rivendell_20210623_113602.BirdNET.results.r.csv',
   row.names = FALSE, quote = FALSE, sep = ','
)

data(exampleBirdNET2)
write.table(
   x = exampleBirdNET2,
   file = 'example-results-directory/Rivendell_20210623_114602.BirdNET.results.r.csv',
   row.names = FALSE, quote = FALSE, sep = ','
)

# Gather formatted BirdNET results
formatted.results <- birdnet_gather(
  results.directory = 'example-results-directory',
  formatted = TRUE
)

# Gather unformatted (raw) BirdNET results
raw.results <- birdnet_gather(
  results.directory = 'example-results-directory',
  formatted = FALSE
)

# Delete all temporary example files when finished
unlink(x = 'example-results-directory', recursive = TRUE)


## End(Not run)


nationalparkservice/NSNSDAcoustics documentation built on March 4, 2025, 10:24 p.m.