R/validate.R

Defines functions validate_coords.steps_xy validate_coords.track_xyt validate_coords.track_xy validate_coords validate_covars

#' @keywords internal
validate_covars <- function(x) {
  if (!is(x, "SpatRaster")) {
    x <- raster_to_terra(x)
  }
  checkmate::assert_class(x, "SpatRaster")
}



#' @keywords internal
validate_coords <- function(x, ...) {
  UseMethod("validate_coords", x)
}


#' @keywords internal
validate_coords.track_xy <- function(x, allow.na = FALSE, ...) {
  checkmate::assert_numeric(x$x_, any.missing = allow.na)
  checkmate::assert_numeric(x$y_, any.missing = allow.na)
  TRUE
}

#' @keywords internal
validate_coords.track_xyt <- function(x, allow.na = FALSE, ...) {
  checkmate::assert_numeric(x$x_, any.missing = allow.na)
  checkmate::assert_numeric(x$y_, any.missing = allow.na)
  TRUE
}

#' @keywords internal
validate_coords.steps_xy <- function(x, allow.na = FALSE, ...) {
  checkmate::assert_numeric(x$x1_, any.missing = allow.na)
  checkmate::assert_numeric(x$x2_, any.missing = allow.na)
  checkmate::assert_numeric(x$y1_, any.missing = allow.na)
  checkmate::assert_numeric(x$y2_, any.missing = allow.na)
  TRUE
}

Try the amt package in your browser

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

amt documentation built on June 25, 2024, 1:14 a.m.