allisonglider / seabiRds

Tools for analysis of seabird biologger data collected by the Arctic Ecology Lab.
1 stars 1 forks source link

issues with getSessions() for foraging bouts within trips #52

Closed francisvolh closed 2 years ago

francisvolh commented 3 years ago

Hi Allison! I am having some issues with labeling foraging bouts for my gps data using getSessions().

Basically I run getSessions() on my full gps data, to label trip_ids for each deployment, and also label foraging or not (1 and 0, with a basic speed threshold).

It happens that I have some trip_ids that are only 1 gps point basically (just away from colony over my 5km threshold, slows down, and back, ), which is a foraging point (=1).

When I try to getSession() I get an error, even after filtering for NAs for my foraging parameter, which I use for getSeesions(). I paste the error output below.

I would assume that getSessions() could just label that trip as a single session for foraging and keep going but it seems is and issue.

gps.data1 <- gps.data %>%

  • filter(!is.na(foraging))%>%
  • filter(!is.na(trip_id))%>%
  • filter(trip_id>0) gps.data1 <- gps.data1 %>%
  • group_by(dep_id, trip_id) %>%
  • mutate(
  • forBoutID = getSessions(foraging, ignore = T, ignoreValue = 0)
  • ) Error: Problem with mutate() column forBoutID. i forBoutID = getSessions(foraging, ignore = T, ignoreValue = 0). x missing value where TRUE/FALSE needed i The error occurred in group 29: dep_id = "A06PEBO_17112019_A105", trip_id = 8. Run rlang::last_error() to see where the error occurred.
allisonglider commented 3 years ago

Hi Francis,

I think I have made a fix to the code that will allow getSessions() to work when there is only one observation per group. Could you install the dev version of seabiRds and try it with your data?

devtools::install_github("allisonglider/seabiRds@dev")

If this fixes your issue, then I will merge it into the main branch.

Allison