## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(fpod) fn <- fp_example("gullars_period1.FP3") dat <- fp_read(fn) ## ----------------------------------------------------------------------------- names(dat) ## ----------------------------------------------------------------------------- str(dat$header) ## ----------------------------------------------------------------------------- as.POSIXct("1900-01-01", tz="") + dat$header$first_logged_min * 60 ## ----------------------------------------------------------------------------- str(dat$env) ## ----------------------------------------------------------------------------- str(dat$wav) ## ----------------------------------------------------------------------------- str(dat$clicks) ## ----------------------------------------------------------------------------- nbhf <- dat$clicks[species == "NBHF" & quality_level >= 2] dpm <- fp_summarize(nbhf) print(dpm) ## ----------------------------------------------------------------------------- sum(dpm$dpm) ## ----------------------------------------------------------------------------- buzz <- fp_find_buzzes(nbhf) str(buzz) table(buzz) ## ----------------------------------------------------------------------------- nrow(nbhf) length(buzz) ## ----------------------------------------------------------------------------- nbhf$buzz <- buzz ## ----------------------------------------------------------------------------- dpm2 <- fp_summarize(nbhf) sum(dpm2$dpm) sum(dpm2$bpm) ## ----------------------------------------------------------------------------- dpm_per_day <- dpm2[, .(dpm = sum(dpm), bpm = sum(bpm)), .(date = as.Date(time))] ## ----fig.width=6, fig.height=4, out.width='100%'------------------------------ mat <- matrix(c(dpm_per_day$dpm - dpm_per_day$bpm, dpm_per_day$bpm), nrow=2, byrow=TRUE) barplot(mat, las = 2, ylim=c(0,250), col = c("tomato2", "dodgerblue4"), names.arg = format(dpm_per_day$date, "%b %d"), xlab="", ylab = "DPMs") legend("topright", inset = 0.05, fill = c("tomato2", "dodgerblue4"), legend = c("DPM", "BPM"))