https://github.com/cran/spatstat
Raw File
Tip revision: ace26c246ee6feb8779515fa668bec59b24a1fcc authored by Adrian Baddeley on 12 March 2007, 13:35:27 UTC
version 1.11-2
Tip revision: ace26c2
rlabel.R
#
#   rlabel.R
#
#   random (re)labelling
#
#   $Revision: 1.2 $   $Date: 2006/10/10 04:22:48 $
#
#
rlabel <- function(X, labels=marks(X), permute=TRUE) {
  verifyclass(X, "ppp")
  if(is.null(labels))
    stop("labels not given and marks not present")
  Y <- X %mark% sample(labels, X$n, replace=!permute)
  return(Y)
}

back to top