Cleber N.Borges
2012-Oct-14 17:29 UTC
[R] How to transform the paths of MST {ape} in SpatialLines objects {sp} ?
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] )