-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
79 lines (58 loc) · 2.99 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# audiomoth.tools
<!-- badges: start -->
[![R-CMD-check](https://github.com/samherniman/audiomoth.tools/workflows/R-CMD-check/badge.svg)](https://github.com/samherniman/audiomoth.tools/actions)
<!-- badges: end -->
[Audiomoths](https://www.openacousticdevices.info/audiomoth) are super cool autonomous recording units (ARUs) that record audio on a set recording schedule. They are often used to record the calls of birds or bats in an environment. Audiomoth.tools is a collection of functions that I have put together when using my Audiomoth. Feel free to recommend changes or improvements!
## Installation
You can install the development version of this package from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("samherniman/audiomoth.tools")
```
## Example
```{r example}
library(audiomoth.tools)
```
Currently, there are only two useful functions in this package:
Use `extract_header_info` to extract the information contained in the headers of each WAV file. The headers contain the recording date, time, serial number, gain setting, battery state, and temperature. More details and Python code are provided by Open Acoustic Devices [here](https://github.com/OpenAcousticDevices/Application-Notes/blob/master/AudioMoth_Temperature_Measurements.pdf). This function extracts these data from the header of all Audiomoth files in a given directory and returns a dataframe.
```{r extract-header}
extract_header_info(system.file("extdata", package = "audiomoth.tools"), recursive = FALSE)
```
Here's an example of a figure you can make with the temperature.
```{r graph-temp, eval=FALSE, warning=FALSE, message=FALSE}
header_df <- vroom::vroom(system.file("extdata", "header_df.csv", package = "audiomoth.tools"))
library(ggplot2)
library(magrittr)
header_df %>%
ggplot(data = .)+
geom_point(aes(x = recorded_date_time, y = temperature_celcius, color = temperature_celcius))+
geom_smooth(
aes(x = recorded_date_time, y = temperature_celcius),
method = 'gam',
se = FALSE,
color = "brown"
)+
scico::scale_color_scico("Temperature (°C)", palette = "romaO", direction = -1) +
labs(y = "Temperature (°C)", x = "Date") +
theme(
panel.background = element_rect(fill = "grey98"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank())
```
![](man/figures/README-graph-temp-2.png)
Depending on your version of the audiomoth software, filenames may look like `20210201_210100T.WAV` (YYYYMMDD_HHMMSST). If you want to upload these files to [Arbimon](https://arbimon.rfcx.org/), you may have to remove the *T* at the end of each filename. You can use `rename_audiomoth_files` to do this.
```{r rename, eval=FALSE}
rename_audiomoth_files(system.file("extdata", package = "audiomoth.tools"))
```