Description Usage Arguments Value Note Examples
Spatio-temporal overlay of Track
objects with objects inheriting
from class Spatial
or STF
objects as well as their data.frame
counterparts.
For the spatial or spatio-temporal geometries of x
the indices or attributes from the Track
object are returned.
If x
inherts from class Spatial
the returned object is extended,
such that it respects the temporal information of the Track
object. In particular that means that
the returned object has one value (may also be NA) for each combination from the spatial geometries with
the timestamps from the Track
object.
If fn
and weight.points
are adequately specified a weighted aggregation is performed.
For further details please see the vignette!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## S4 method for signature 'STF,Track'
over(x, y, returnList = FALSE, fn = NULL, ...,
use.data = FALSE, weight.points = NULL)
## S4 method for signature 'SpatialPolygons,Track'
over(x, y, returnList = FALSE,
fn = NULL, ..., use.data = FALSE, weight.points = NULL)
## S4 method for signature 'SpatialPixels,Track'
over(x, y, returnList = FALSE,
fn = NULL, ..., use.data = FALSE, weight.points = NULL)
## S4 method for signature 'SpatialGrid,Track'
over(x, y, returnList = FALSE, fn = NULL,
..., use.data = FALSE, weight.points = NULL)
|
x |
object of class |
y |
|
returnList |
logical, indicates if a list should be returned |
fn |
(optional) aggregation function, that expects a vector of weights as its second argument
if the argument |
... |
optional additional arguments to |
use.data |
logical or a vevtor of indices or a vector of column names, indicating if
indices ( |
weight.points |
|
The returned object depends on the specified arguments and it is consistent with the over
methods defined in the packages sp and spacetime. For further details please see also the vignette.
The weight.points argument should just be specified if a function that expects a vector of weights as
its second argument is passed to fn
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ## Load example toy data
load(system.file("extdata","trajaggr_TestData.RData", package = "trajaggr"), verbose = FALSE)
## Example 1: overlay of Track and Spatial object
# returnList = FALSE returns index vector
over_sp <- over(spPolys, Track_A1, returnList = FALSE)
dim(spPolys)
dim(Track_A1)
over_sp
# returnList = TRUE returns list of indices
over_sp <- over(spPolys, Track_A1, returnList = TRUE)
over_sp[1:7]
# use.data = TRUE and returnList = TRUE returns list of data.frames
over_sp <- over(spPolys, Track_A1, returnList = TRUE, use.data = TRUE)
over_sp[1:7]
# use.data = TRUE and returnList = FALSE returns data.frames
# with (first) data element
over_sp <- over(spPolys, Track_A1, returnList = FALSE, use.data = TRUE)
over_sp[1:7, ]
##
## Example 2: overlay of Track and STF object with two time intervals
# returnList = FALSE returns index vector
over_stf <- over(stf_Polys_2t, Track_A1, returnList = FALSE)
dim(stf_Polys_2t)
dim(Track_A1)
over_stf
# returnList = TRUE returns list of indices
over_stf <- over(stf_Polys_2t, Track_A1, returnList = TRUE)
over_stf
# use.data = TRUE and returnList = TRUE returns list of data.frames
over_stf <- over(stf_Polys_2t, Track_A1, returnList = TRUE, use.data = TRUE)
over_stf
# use.data = TRUE and returnList = FALSE returns data.frames with (first)
# data element
over_stf <- over(stf_Polys_2t, Track_A1, returnList = FALSE, use.data = TRUE)
over_stf
# use.data = TRUE and returnList = FALSE and fn = mean returns aggregated values
over_stf_mean <- over(stf_Polys_2t, Track_A1, returnList = FALSE, fn = mean,
use.data = TRUE)
over_stf_mean
# use.data = TRUE and returnList = FALSE and fn = weighted.mean
# and additionally specified weight.points = 'byTime' returns weighted
# aggregated values
over_stf_wmean <- over(stf_Polys_2t, Track_A1, returnList = FALSE,
fn = weighted.mean, weight.points = "byTime", use.data = TRUE)
over_stf_wmean
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.