R/components.R

Defines functions n.comp.nb

Documented in n.comp.nb

# Copyright 2001 by Nicholas Lewin-Koh 
#


n.comp.nb <- function(nb.obj){
  if(!inherits(nb.obj,"nb"))stop("not a neighbours list")
  nb.obj <- make.sym.nb(nb.obj)
  comp <- rep(0,length(nb.obj))
  comp <- .Call("g_components", nb.obj, as.integer(comp), PACKAGE="spdep")
  answ <- list(nc=length(unique(comp)), comp.id=comp)
  answ
}

Try the spdep package in your browser

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

spdep documentation built on Nov. 23, 2023, 9:06 a.m.