The trip package provides facilities to access and manipulate
spatial-temporal data organized for tracking movements. Data with
locations, date-times, and grouping IDs for trips are formally declared
trip() function and enables easy calculation of step
distance and angle and grouped summaries of trip duration and length.
Conversion from and to many disparate formats is a key focus, and data may be treated as points-in-time or as line segments with a start/end time property. There are functions for simple speed-distance-angle filtering determining time-spent in area and creating line or point plots with standard R spatial tools and graphics.
Track data may be read from various Argos formats with
readDiag(), from generic data frame or spatial- data frames, and many
types of objects from other tracking packages are supported.
Trip objects can be imported directly from types defined in packages
sp. When these formats do not have time or trip-grouping values they
may be declared by name. A generic data frame may be converted to trip
by organizing the x, y, time, ID columns in order, or by a combination
of row grouping with x, y, time columns. All other data are retained in
the obvious way.
Trip objects can be used to create other data types defined by
spatstat, and this is possible for
conversion to point types or line types. For example,
"SpatialLinesDataFrame") creates a single multi-line for each trip,
with start and end time properties. The
explode(trip) function breaks
a trip into individual line segments for every pair of coordinates, and
as(trip, "SpatialPointsDataFrame") will create a standard sp points
data frame. There are similar facilities for
sf types, and for the
spatstat types point pattern
as.ppp(trip) or line segments
Trips can be exported to Google Earth and explored using the continuous
time slider with the
trip() function performs a significant series of data validation,
to ensure that basic sense prevails. The function will always proceed to
give a valid trip object, and simply warn about which problems had to be
overcome. These validation checks can be used to discover what is wrong
with a particular set of data, and in time we hope this to become much
more powerful and transparent.
Trip objects can be reproject directly with the
in the usual way, and functions that are coordinate system aware such as
raster::extract will automatically reproject the coordinates behind
the scenes. We are developing more sophisticated point-in-time data
routines and auto-reprojecting map
functions in related projects.
Some simple data summary methods have gone out of favour or been
ignored, and trip provides direct access to the
rasterize() functions for straightforward data filtering on
maximum speed, minimum angle/distance, and time-spent-in-area gridding.
There is a
homedist() function to calculate the maximum distance from
each trip’s starting point, and various old-school functions. Some of
these will be improved and better exposed in time.
vignette("trip") for more.
Let us know what you think via Issues.
The package is easily installed from CRAN in R.
To install the development package from Github:
cut.tripcan for rasterizing, possibly needs a second-level ID grouping
Trip would be better implemented on top of the ideas in the silicate package, rather than the twilight zone between MULTIPOINTs and LINESTRINGs as it is now.
Please me know what you think via Issues.
## Code of Conduct
Please note that the trip project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.