View source: R/subsetTrajectories.R
subsetTrajectories | R Documentation |
Subsets data structures for trajectory analysis
subsetTrajectories(
x,
site_selection = NULL,
subtrajectory_selection = NULL,
survey_selection = NULL
)
x |
An object of class |
site_selection |
A character vector indicating the subset of entity (site) trajectories to be selected (if NULL, all sites are included). |
subtrajectory_selection |
A character vector indicating the subset of cycles or fixed date trajectories to be selected (only used when |
survey_selection |
An integer vector indicating the subset of surveys to be included (if NULL, all surveys are included). |
When using function subsetTrajectories
on cycles or fixed-date trajectories then the parameter site_selection
applies to sites
(hence allows selecting multiple cycles or fixed-date trajectories). Specific cycles or fixed-date trajectories can be selected using trajectory_selection
.
An object (list) of class trajectories
(or its children subclasses fd.trajectories
or cycles
), depending on the input.
defineTrajectories
, trajectoryCyclical
#Description of entities (sites) and surveys
entities <- c("1","1","1","2","2","2")
surveys <- c(1,2,3,1,2,3)
#Raw data table
xy<-matrix(0, nrow=6, ncol=2)
xy[2,2]<-1
xy[3,2]<-2
xy[4:6,1] <- 0.5
xy[4:6,2] <- xy[1:3,2]
xy[6,1]<-1
d <- dist(xy)
# Defines trajectories
x <- defineTrajectories(d, entities, surveys)
x
# Extracts (subset) second trajectory
x_2 <- subsetTrajectories(x, "2")
x_2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.