R/listNbh.R

Defines functions listNbh

listNbh <- function(object,y,val){
  stopifnot(inherits(object,"neighborhood"))
  if (missing(y)) y=object$neighbors
  else{
    stopifnot(length(y)==object$n)
    y=y[object$neighbors]
  }
  if (missing(val)) val <- object$values
  posVal <- match(val,object$values,nomatch=FALSE)
  stopifnot(all(posVal!=0))
  out <- split(y,rep(1:object$nu,object$size.nbh))[posVal]
  out
}

Try the prodlim package in your browser

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

prodlim documentation built on June 24, 2024, 5:08 p.m.