knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of batr is to streamline analyses and reporting of bat acoustic monitoring data containing GUANO metadata. The package includes code to extract GUANO data directly from attributed WAV files, and to create summaries, plots, and analyses.
The package has been written as part of and to support conservation research by the Toronto Zoo's Native Bat Conservation Program, and is shared here in case it benefits anyone else. It remains a work in progress and feedback and contributions are welcome.
Check development progress and latest changes here.
A major update was released in Winter 2023 which involves a significant shift in philosophy and rewrite of functionality. This broke all the old functions, which are now depreciated but still present for the time being. However, the trade off is that lots of things work better. New features:
If anyone out there wants the old version (0.1.0) you can find it here here and the documentation here. Note that this version is hard-coded for Ontario bat species only.
Install the current version from GitHub using the following code:
# install.packages("devtools") devtools::install_github("vulpes-vulpes/batr")
This package is designed to function with bat acoustic monitoring data, in the form of a collection of WAV files, that have been processed to add species identifications and other descriptive information as metadata. Specifically, the metadata should use the GUANO specification (thanks to David Riggs for creating this standard), which us used by most modern bat recording devices and analysis software. At minimum your files need to have the following columns for batr to use them:
Use the 'import_GUANO' function to import the metadata directly from WAV files. This function takes a folder of WAV files that are recordings of bats with appropriate GUANO metadata already attributed (as described above), finds all the GUANO, and then gives you a new RDATA file that contains all of that GUANO in once place. Along with the directory you want to import, you need to specify the "site_col" (column containing a unique reference for each site where data monitoring occurred), the timezone the data were recorded in, and whether or not you want to create a new RDATA file, add additional data to an existing one, or update an existing RDATA file from files with with changed GUANO.
WHY? Once you have processed a set of acoustic data all the cool and valuable information that you want for fuhrer analyses is in the GUANO metadata (e.g. what species, where, and when). Having that data spread across all the WAV files is unhelpful because: 1) they are relatively huge and you have to lug all that sound data around even when you're not using it; and 2) having that data spread across thousands of small files makes it really slow to read. The batr import_GUANO functions does that slow reading step once and provides a much more portable file to work with thereafter.
Notes: - Reading the GUANO of thousands of small files is s....l....o....w....! Ideally you'll only do it once, and one day it may get faster, but in the meantime pack your patience pills and read from WAV files on an SSD if you can - batr will warn you if your data are missing essential columns, and identify problem files so you can fix them. Unfortunately it has to read them, the slow step, first.
The function to update files previously imported into an RDATA file that have new GUANO does not currently work, fix coming!
Most automated bat acoustic monitoring hardware produce some form of log file to track device activity, errors etc. These files contain valuable data to determine survey effort: determining whether the unit was active at a given time. This is valuable for many analyses, especially those involving long-term data collection, because it makes it possible to determine whether a result of zero bats observed in a given time period occurred because there were zero bats, or because the recording device was inactive for any reason at that time.
batr currently has the ability to import and parse such files from the following devices:
If you wish to see log files from other devices support please get in touch and send example files or a suggestion, and I'll see what I can do.
Once you have your files organised as outlined above, use the 'import_logs' function to add them to an existing RDATA file, or a new one.
summary_table
: outputs a summary table with the total number of observations per species per locationspecies_daily_site_plot
: outputs a plot showing total activity on a nightly basis for a specified species, faceted by locationfirst_observations_plot
: outputs a plot showing the time of the first nightly observation of the specified species relative to local sunset, faceted by locationlist_all_locations
: outputs a list of all unique locations in the datasetset_locations_list
: allows you to set a list of locations that will be used to subset the data for other functions (e.g. if a location list has been set, any plots created subsequently will only use data from these locations)show_locations_list
: reveals the above list, if setlist_all_species
/ set_species_list
/ show_species_list
: as above but with species instead of locationsmanual_vet_extractor
: outputs a copy of random subset of data, filtered by species and / or location as required, to facilitate manual vettingAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.