R/pf_dup_dates.R

Defines functions pf_dup_dates

Documented in pf_dup_dates

##' @title Find observations with duplicate dates
##'
##' @param x input data from `format_data()`
##' @param min.dt minimum allowable time difference in s between observations; 
##' `dt < min.dt` will be ignored by the SSM
##' @keywords internal
##' @md

pf_dup_dates <- function(x, min.dt) {

  x$keep <- difftime(x$date, c(as.POSIXct(NA), x$date[-nrow(x)]), 
                     units = "secs") > min.dt
  
  x$keep <- ifelse(is.na(x$keep), TRUE, x$keep)
  
  return(x)
}
ianjonsen/foieGras documentation built on Jan. 17, 2025, 11:15 p.m.