I have searched extensively for some good examples or documentation on how
to create a SpatialLinesDataFrame and for the life of me have found zilch.
This does not mean there is no such thing available, it just means that
wherever it is it is not readily accessible through the circuitous pathways
of R help documentation or via a simple web search.  As someone who
struggles daily to achieve highly technical things with scarcely the savvy
required, I wish there were more (or any?) examples in the documentation for
most of the spatial packages available.  (I also wish that managing and
manipulating Spatial objects was about 65% less complicated, but for the
moment let's start with this)...

I have a data.frame (temp) containing endpoints of animal trajectories with
which I would like to create a SpatialLinesDataFrame for export into a GIS.

> temp
       id                 day       x        y        X2       Y2
1 2002007 2005-04-04 12:01:01 -300358 748992.6 -300450.8 748764.8
2 2002007 2005-04-04 12:01:01 -300358 748992.6 -301694.2 751728.4
3 2002007 2005-04-04 12:01:01 -300358 748992.6 -299983.1 749528.8
4 2002007 2005-04-04 12:01:01 -300358 748992.6 -300569.4 749640.7
5 2002007 2005-04-04 12:01:01 -300358 748992.6 -300439.0 748308.8

I seem reasonably able to create a Lines object (though I can't get the ID
argument to work for me where there are multiple records involved)....

> ranlines<-apply(temp, 1,  function(x)
Lines(Line(list(rbind(as.numeric(x[7:8]), as.numeric(x[9:10]))))))

> str(ranlines[[1]])
Formal class 'Lines' [package "sp"] with 2 slots
  ..@ Lines:List of 1
  .. ..$ :Formal class 'Line' [package "sp"] with 1 slots
  .. .. .. ..@ coords: num [1:2, 1:2] -300358 -300451 748993 748765
  .. .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. .. ..$ : NULL
  .. .. .. .. .. ..$ : chr [1:2] "X1" "X2"
  ..@ ID   : chr NA

Am I at least on the right track?   Unfortunately now I'm clueless as to
what to do next because apparently Lines cannot be coerced to SpatialLines,
and while I am normally able to figure my way out of things there is just
nothing intuitive about this as far as I can tell.  I have tried to create
SLDFs numerous times in the past and I have always been discouraged from
continuing.  I can create a psp object in Spatstat but I am equally unable
to convert that into a SLDF shape.  Terribly sorry about the rant but it's
difficulties like these that prevent a lot of people more clueless than me
from ever getting anywhere with R and more specifically the spatial
stuff....

Tyler

	[[alternative HTML version deleted]]

