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
    X$marks$PointType <- sample(X$marks$PointType)
    return(X)
  } else {
    # wmppp case
    # Randomize marks
    RandomizedX <- rlabel(X)
    # Restore weights
    RandomizedX$marks$PointWeight <- X$marks$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 May 31, 2023, 8:30 p.m.