-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathExtract.trajectory.Rd
64 lines (52 loc) · 1.74 KB
/
Extract.trajectory.Rd
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trajectory-methods.R
\name{Extract.trajectory}
\alias{Extract.trajectory}
\alias{[.trajectory}
\alias{[[.trajectory}
\alias{[<-.trajectory}
\alias{[[<-.trajectory}
\title{Extract or Replace Parts of a Trajectory}
\usage{
\method{[}{trajectory}(x, i)
\method{[[}{trajectory}(x, i)
\method{[}{trajectory}(x, i) <- value
\method{[[}{trajectory}(x, i) <- value
}
\arguments{
\item{x}{the trajectory object.}
\item{i}{indices specifying elements to extract. Indices are \code{numeric}
or \code{character} or \code{logical} vectors or empty (missing) or \code{NULL}.
Numeric values are coerced to integer as by \code{\link{as.integer}} (and
hence truncated towards zero). Negative integers indicate elements/slices to
leave out the selection.
Character vectors will be matched to the names and tags of the activities
in the trajectory as by \code{\link{\%in\%}}.
Logical vectors indicate elements/slices to select. Such vectors are recycled
if necessary to match the corresponding extent.
An empty index will return the whole trajectory.
An index value of \code{NULL} is treated as if it were \code{integer(0)}.}
\item{value}{another trajectory object.}
}
\value{
Returns a new trajectory object.
}
\description{
Operators acting on trajectories to extract or replace parts.
}
\examples{
x <- join(lapply(1:12, function(i)
trajectory() \%>\% timeout(i)
))
x
x[10] # the tenth element of x
x[-1] # delete the 1st element of x
x[c(TRUE, FALSE)] # logical indexing
x[c(1, 5, 2, 12, 4)] # numeric indexing
x[c(FALSE, TRUE)] <- x[c(TRUE, FALSE)] # replacing
x
}
\seealso{
\code{\link{length.trajectory}}, \code{\link{get_n_activities}},
\code{\link{join}}.
}