Skip to content
Prev 8336 / 29559 Next

SpatialPointDataFrame to SpatialLinesDataFrame

Your question is this time different from the initial one. Also, the
example you provide is not reproducable for others. Does the example
below match what you have in mind?

library(sp)
data(meuse)
lst = split(meuse[c("x","y")], meuse$soil)
x = SpatialLines(sapply(1:length(lst),
        function(i) Lines(list(Line(lst[[i]])), as.character(i))
    )
)
x.sl = SpatialLinesDataFrame(x, data.frame(soil=unique(meuse$soil)))
plot(x.sl, col=x.sl$soil)
On 05/26/2010 11:37 AM, Paulo Eduardo Cardoso wrote: