R/utils.R

Defines functions check_point_matrix is_point_matrix

#' @export
is_point_matrix <- function(points) {
  dims <- dim(points)
  is.numeric(points) && !is.null(dims) && length(dims == 2) && dims[2] == 2
}

#' @importFrom rlang !!
#' @export
check_point_matrix <- function(points) {
  name <- rlang::as_label(dplyr::enquo(points))
  if(!is_point_matrix(points)) {
    stop(paste0("The parameter `", name, "` is not a matrix (numeric matrix with dimensions [X, 2])"))
  }
}
cas-bioinf/metagenboot documentation built on Feb. 25, 2021, 3:58 p.m.