View source: R/mt_as_track_attribute.R
mt_as_track_attribute | R Documentation |
mt_as_track_attribute
: move a column from the event to the track attributes
mt_as_event_attribute
: move a column from the track to the event attributes
mt_as_track_attribute(x, ..., .keep = FALSE)
mt_as_event_attribute(x, ..., .keep = FALSE)
x |
The move2 object |
... |
the names of columns to move, it is also possible to use |
.keep |
a logical if the variables also kept in their original location |
When one or more of the selected columns contain more then one unique value per track an error is raised.
An object of the class move2
with the column(s) moved
mt_track_data()
to retrieve the track attribute table
mt_set_track_data()
to replace attribute table with new values
sim_data <- mt_sim_brownian_motion()
sim_data$sex <- "female"
## different ways to move column "sex" from event to track attribute
sim_data |> mt_as_track_attribute(sex)
sim_data |> mt_as_track_attribute(starts_with("s"))
sim_data |> mt_as_track_attribute(any_of(c("sex", "age")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.