R-CMD-check codecov

cavityuse

Detecting Cavity Use From Geolocator Data

cavityuse is an R package for calculating patterns of cavity use from geolocator light data. Patterns of light and dark are used to identify daytime usage, while patterns of sunrise/sunset are used to identify nighttime usage.

While cavityuse is ready to be experimented with, it's still in early development and should be considered experimental. Please give me a hand by letting me know of any problems you have (missing functionality, difficult to use, bugs, etc.)

knitr::opts_chunk$set(fig.path = "man/figures/", out.width = "100%", 
                      fig.asp = 0.5, fig.width = 10)

Installing cavityuse

You can install cavityuse directly from my R-Universe:

install.packages("cavityuse", 
                 repos = c("https://steffilazerte.r-universe.dev", 
                           "https://cloud.r-project.org"))

Getting started

Load the package

library(cavityuse)

We'll get started with the built in example file calib which clearly shows sunrise/sunset events

Let's take a look at the patterns in the raw data:

cavity_plot(calib)

Look for any sunrise/sunset events in your geolocator data

s <- sun_detect(calib)
s

Let's see what these look like

cavity_plot(data = calib, sun = s, days = 1)

Now let's move on to the flicker data set:

cavity_plot(flicker)
s <- sun_detect(flicker) # Nothing detected
e <- cavity_detect(flicker, sun = s)
e

Let's see how these assignments match the patterns we see

cavity_plot(data = flicker, cavity = e)

With your own data

You data must be in a data frame with the columns called time and light.

For example:

dplyr::select(flicker, time, light)

Consider using the lubridate package to format your times

Timezones

Most geolocator data is in the UTC timezone, and although previous versions of cavityuse recommended converting your data to your the timezone of your location (non-daylight savings), I now recommend keeping it in UTC. cavityuse will apply a timezone offset to your data according to the location.

This means that the time output by cavityuse will be in UTC according to R, however it will actually have had an offset applied (noted in the new column tz_offset). This just makes things simpler.

Coordinates

cavityuse functions require coordinates in order to more efficiently detect sunrise/sunset times, but also to estimate sunrise/sunset when they are not detected in the data.

You can supply coordinates in one of two ways.

dplyr::select(flicker, time, light, lon, lat)
sun_times(data, loc = c(-120.3408, 50.67611))

Limitations

Right now, cavityuse is limited to the follow scenarios:

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



steffilazerte/cavityuse documentation built on Aug. 4, 2022, 11:22 p.m.