R/Khat.R

Defines functions Khat

Documented in Khat

Khat <- function(
    X,
    r = NULL,
    ReferenceType = "",
    NeighborType = ReferenceType,
    CheckArguments = TRUE) {

  if (CheckArguments) {
    CheckdbmssArguments()
    # Eliminate erroneous configurations
    if ((ReferenceType == "" | NeighborType == "") & (ReferenceType != NeighborType)) {
      stop("Either two or no point type must be specified.")
    }
  }

  # K intra
  if (ReferenceType == "" & NeighborType == "") {
    return(Kest(X, r = r, correction = "best"))
  }
  # K intra for a single point type
  if (ReferenceType == NeighborType) {
    X.reduced <- X[marks(X)$PointType == ReferenceType]
    return(Kest(X.reduced,  r = r, correction = "best"))
  }
  # K inter calls Kcross. The marks must contain the type, with no weight.
  if (ReferenceType != NeighborType) {
    X.cross <- X
    marks(X.cross) <- marks(X)$PointType
    return(
      Kcross(
        X.cross,
        i = ReferenceType ,
        j = NeighborType,
        r = r,
        correction = "best"
      )
    )
  }
}

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.