Skip to content
Prev 2585 / 29559 Next

problem on converting the coordinates into interval [0, 1]?

On Mon, 24 Sep 2007, zhijie zhang wrote:

            
Exactly - with the original data, the units *are* general, because they 
are in meters. Provided the other data is also using the same metric, this
also permits a direct interpretation of bandwidth, possibly with a 
physical or biological basis. In the same sense, you can also get a 
relative bandwidth from (bw / max(diff(bbox(<obj>)))), and multiply it out 
again for a different context.
Just loops of lapply(), not worse:

lns <- slot(rivers, "lines")

new_lns <- lapply(lns, function(x) {
   Lns <- slot(x, "Lines")
   new_Lns <- lapply(Lns, function(y) {
     new_crds <- mess_up(slot(y, "coords"))
     Line(new_crds)
   })
   Lines(new_Lns, ID=slot(x, "ID")
})
new_rivers <- SpatialLines(new_lns)

for your mess_up() - note, untried. Also note that the projection will not 
be defined.

Roger