Hello all,
I would like to transform the paths of MST {ape} in SpatialLines objects.
But I don't understand the mechanical procedure in SpatialLines-class of
'sp' package.
Please, somebody can help me?
Thanks in advanced.
Cleber N.Borges
### my (half) trial
library(sp);
library(ape) # for 'mst' function
n <- 20
x <- runif( n )
y <- runif( n )
coords <- cbind( x, y )
plot( coords )
r <- which( mst(dist(coords))==1, arr.ind=T )
segments( coords[r[,1],1], coords[r[,1],2], coords[r[,2],1],
coords[r[,2],2] )
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.