R/select_gaps.R

Defines functions select_gaps

Documented in select_gaps

select_gaps <- function(tracks, cgaps) {

  # Check variables
  e <- val_psyo(tracks, 0, 0, 0, 0, 0); if (e != "") {stop(e)}
  e <- val_cname(tracks, cgaps, type = "logical", def = FALSE); if (e != "") {stop(e)}

  # Check if one gaps column
  if (length(cgaps) == 1 && cgaps != "") {
    tracks <- tracks[ which(tracks[,cgaps]) ,]
  }

  # Multiple gap columns
  if (length(cgaps) > 1) {
    tracks <- tracks[ rowSums(tracks[,cgaps],na.rm = TRUE) >= 1 ,]
  }

  # Return result
  return(tracks)

}

Try the psyosphere package in your browser

Any scripts or data that you put into this service are public.

psyosphere documentation built on July 2, 2020, 12:08 a.m.