View source: R/long_to_periods.R
long_to_periods | R Documentation |
Transform data from long format to period format
long_to_periods(data, .id, .start, .stop = NULL, .by = NULL)
data |
a data.frame |
.id |
a character, column containing individual ids |
.start |
a character, column containing time variable indicating the beginning of each row |
.stop |
a character, column containing time variable indicating the end of each row. If not provided, it will be derived from the dataset, considering that each row ends at the beginning of the next one. |
.by |
a character vector, co-variables to consider (optionnal) |
## Not run:
load(url("https://larmarange.github.io/analyse-R/data/care_trajectories.RData"))
care_trajectories
long_to_periods(care_trajectories, .id = "id", .start = "month")
long_to_periods(care_trajectories,
.id = "id", .start = "month",
.by = c("sex", "age", "care_status")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.