activity: Activity

View source: R/transformations.R

activityR Documentation

Activity

Description

Calculate activity status (active vs. inactive) at a resolution of res from presence() data.

Usage

activity(
  p,
  res = 15,
  by_logger = FALSE,
  missing = NULL,
  sun = TRUE,
  keep_all = FALSE,
  pass = TRUE,
  f
)

Arguments

p

Dataframe. A presence() data frame (may contain multiple animal_ids).

res

Numeric. The resolution over which to calculate activity in minutes.

by_logger

Logical. Should the activity be calculated overall, or individually for each logger visited? If there is only one logger, by_logger will automatically revert to TRUE to enable passing of logger-related variables.

missing

Data frame. (NOT AVAILABLE) If there are known times for a particular logger for which activity can't be recorded (i.e. times during which a logger was inactive).

sun

Logical. Calculate sun rise/set? If by_logger = FALSE, returns median sun rise/set across all loggers for each day.

keep_all

Logical. Keep all individuals, even ones with less than 24hrs of data.

pass

Logical. Pass 'extra' columns through the function and append them to the output.

f

Depreciated. Use p.

Details

A message will alert you to when the res is larger than the 50\ the presence bout lengths. This may result in missed activity, and it may be better to choose a smaller res.

The missing data frame should have columns start and end corresponding to the start and end times of the missing data. Any activity between those start/end times will be scored as unknown, regardless of the logger_id. However, if by_logger is TRUE, missing may also include the column logger_id. In this case, only activity for the logger with the missing start/end times will be scored as unknown. If by_logger is TRUE but missing does not contain the column logger_id, all activity between the start and end times will be scored as unknown, regardless of the logger. See examples.

Examples


v <- visits(chickadees)
p <- presence(v)
a <- activity(p, res = 1)

# By logger (may take a while)
## Not run: 
a <- activity(p, res = 1, by_logger = TRUE)

## End(Not run)


animalnexus/feedr documentation built on Feb. 2, 2023, 1:12 a.m.