R/drop_ecd_duplicates.R

Defines functions drop_ecd_duplicates

Documented in drop_ecd_duplicates

#' Drop duplicates within an ECDF
#'
#' @param e
#'
#' @return
#' @export
#'
#' @examples
drop_ecd_duplicates <- function(e) {
  d <- e$depth_break
  if(sum(duplicated(d)) < 1) {
    return(e)
  }
  dup_idx <- unique(
    c(which(duplicated(d)), which(duplicated(d, fromLast = TRUE)))
  )
  dup_idx <- head(sort(dup_idx), -1)
  
  e <- e[-dup_idx,]
}
jmlondon/wcUtils documentation built on March 19, 2024, 8:40 a.m.