label_events: Number events (such as foraging events) by bird and trip

View source: R/label_events.R

label_eventsR Documentation

Number events (such as foraging events) by bird and trip

Description

Sometimes it is useful to number events consecutively such as forageing events for a seabird. often times these events have multiple rows per event/bout. This function numbers these evens consecutively by bird and by trip nested within bird.

Usage

label_events(dat, BirdID = "CaptureID", TripID = "TripID", eventCol = "forage")

Arguments

dat

data.frame of with a minimum of three columns with birdID, tripID from the MakeTrip function and a event column

BirdID

a unique ID for each bird

TripID

a unique ID for each trip nested within each bird. I.e. birdA has trips 1,2,3; BirdB has trips 1,2,3,4

eventCol

a column with values indicating the presence of an event. Must be in the format 0= no event, 1= event

Value

A new data frame with all original data plus two new columns: event_bird with numbered events 1:n_vents by bird, and event_trip with numbered events 1:n_events per trip @importFrom dplyr bind_rows

Author(s)

Abram B. Fleishman abram@conservationmetrics.com

Rachael Orben Rachael.Orben@oregonstate.edu


abfleishman/trakR documentation built on Nov. 21, 2022, 7:59 a.m.