R/rRandomLabelingM.R

Defines functions rRandomLabelingM

Documented in rRandomLabelingM

rRandomLabelingM <- function(
    X,
    CheckArguments = TRUE) {

  if (CheckArguments) {
    CheckdbmssArguments()
  }

  if (inherits(X, "Dtable")) {
    # Dtable case
    # Randomize marks
    marks(X)$PointType <- sample(marks(X)$PointType)
    return(X)
  } else {
    # wmppp case
    # Randomize marks
    RandomizedX <- rlabel(X)
    # Restore weights
    marks(RandomizedX)$PointWeight <- marks(X)$PointWeight

    class(RandomizedX) <- c("wmppp", "ppp")
    return(RandomizedX)
  }
}

Try the dbmss package in your browser

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

dbmss documentation built on June 8, 2025, 1:59 p.m.