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)
Thanks!
But by doing this
ltraj - Lines(sapply(split(traj_subam[c(LONGITUDE,LATITUDE)],
traj_subam$TARGET_ID), Line))
we get
Slot ID:
[1] NA
We are not holding the [Target_ID] column as ID ?
2010/5/25 Edzer Pebesma edzer.pebe...@uni-muenster.de:
Here's an example how a Lines object is
When I try to coerce Lnes to SLDF with
ltraj - Lines(sapply(split(traj_subam[c(LONGITUDE,LATITUDE)],
traj_subam$TARGET_ID), Line))
ltraj - SpatialLinesDataFrame(ltraj, traj_subam, match.ID = TRUE)
I get
Error in slot(sl, lines) :
no slot of name lines for this object of class Lines
Any idea?
Sory but I'm not getting this correctly.
a data.frame
print(traj_subam, row.names =F)
ID TIME_STAMP DAY_PERIOD SEASON TARGET_ID LATITUDE
LONGITUDE SPEED HEADING DISTANCE
7127128 2010-03-12 06:26:45 2 4 1712762 38.79497
-8.756062 0.5656855 46 2.828427
Hi,
How can one coerce spatial point to spatial line?
I'm struggling to find a way of coerce a point SPDF object to Lines
based in a ID [TARGET_ID] field.
Any idea will be very welcome.
Formal class 'SpatialPointsDataFrame' [package sp] with 5 slots
..@ data :'data.frame': 28 obs. of
Here's an example how a Lines object is built from several sets of
points (meuse data, split by soil type):
library(sp)
data(meuse)
Lines(sapply(split(meuse[c(x,y)], meuse$soil), Line))
Note that meuse is used as a data.frame in this example; use
as.data.frame on your SPDF to get it.
I hope