Extract.trajectory | R Documentation |
Operators acting on trajectories to extract or replace parts.
## S3 method for class 'trajectory'
x[i]
## S3 method for class 'trajectory'
x[[i]]
## S3 replacement method for class 'trajectory'
x[i] <- value
## S3 replacement method for class 'trajectory'
x[[i]] <- value
x |
the trajectory object. |
i |
indices specifying elements to extract. Indices are Numeric values are coerced to integer as by Character vectors will be matched to the names and tags of the activities
in the trajectory as by 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 |
value |
another trajectory object. |
Returns a new trajectory object.
length.trajectory
, get_n_activities
,
join
.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.