R/utils.R

Defines functions .is.spatial .create_unique_colname

.create_unique_colname <- function(
  id = "id", # candidate name
  nm # vector containing the existing names
  ){
  new_id <- id
  k <- 0
  while(new_id %in% nm) {
    new_id <- paste(id, k, sep = "")
    k <- k + 1
  }
  id
}

.is.spatial <- function(x) {
  if (inherits(x, "Spatial") | inherits(x, "Raster"))
    res <- TRUE
  else
    res <- FALSE

  res
}
pierreroudier/clhs documentation built on April 21, 2022, 2:05 p.m.