mt_as_track_attribute {move2}R Documentation

Move one or more columns to track attributes or event attributes

Description

Usage

mt_as_track_attribute(x, ..., .keep = FALSE)

mt_as_event_attribute(x, ..., .keep = FALSE)

Arguments

x

The move2 object

...

the names of columns to move, it is also possible to use helpers.

.keep

a logical if the variables also kept in their original location

Details

When one or more of the selected columns contain more then one unique value per track an error is raised.

Value

An object of the class move2 with the column(s) moved

See Also

Examples

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")))

[Package move2 version 0.2.7 Index]