Description Usage Arguments Value Examples
Counting trajectories over spatial or spatio-temporal geometries. An Track
object is
counted for a particualr geometry if at least one of its points
spatially or spatio-temporally intersects that particular geometry.
Works also with data.frame
counterparts for the by
argument.
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 | ## S4 method for signature 'Track,STF'
count(x, by)
## S4 method for signature 'Track,SpatialPolygons'
count(x, by)
## S4 method for signature 'Track,SpatialPixels'
count(x, by)
## S4 method for signature 'Track,SpatialGrid'
count(x, by)
## S4 method for signature 'Tracks,STF'
count(x, by)
## S4 method for signature 'Tracks,SpatialPolygons'
count(x, by)
## S4 method for signature 'Tracks,SpatialPixels'
count(x, by)
## S4 method for signature 'Tracks,SpatialGrid'
count(x, by)
## S4 method for signature 'TracksCollection,STF'
count(x, by, byID = FALSE)
## S4 method for signature 'TracksCollection,SpatialPolygons'
count(x, by, byID = FALSE)
## S4 method for signature 'TracksCollection,SpatialPixels'
count(x, by, byID = FALSE)
## S4 method for signature 'TracksCollection,SpatialGrid'
count(x, by, byID = FALSE)
|
x |
an object of class |
by |
an object of class |
byID |
logical; indicating if the counting should be performed individually for each
|
A data.frame
counterpart object of the by
argument's object.
The data.frame
of the returned object contains an attribute 'count' representing the
number of counted Track objects for each spatial or spatio-temporal geometry of by
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Example 1 with toy data
## load example toy data
load(system.file("extdata","trajaggr_TestData.RData", package = "trajaggr"), verbose = FALSE)
countTrC_res <- count(TrColl, spPolys)
class(countTrC_res)
dim(spPolys)
dim(countTrC_res)
slot(countTrC_res, "data")
countTrC_byID <- count(TrColl, spPolys, byID = TRUE)
class(countTrC_byID)
head(slot(countTrC_byID, "data"))
countTrC_bySTF <- count(TrColl, stf_Polys_2t)
class(countTrC_bySTF)
slot(countTrC_bySTF, "data")
##
## Example 2 with wild boars example data
## load data
data(wildboars_4Ind_ltraj)
wb_TrColl <- as(wildboars_4Ind_ltraj, "TracksCollection")
library(sp)
wb_spPoly <- createSpatialArealObjFromPoints(as(wb_TrColl,
"SpatialPointsDataFrame"), desDim = 8, out = "SpatialPixels")
wb_count <- count(wb_TrColl, wb_spPoly)
slot(wb_count, "data")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.