# Example data
dat <- tibble::tibble(
participant_id = c("A123", "A123", "A123", "A123"),
session_id = c("ses-00S", "ses-00A", "ses-00M", "ses-01A"),
a = c(1, 2, 3, 4),
b = c(10, 11, 12, NA)
)
# Create a new column (default: `session_num`) with numeric session
create_session_num(
dat
)
# Create a new column called `num` that contains the session numbers
create_session_num(
dat,
name = "num"
)
Run the code above in your browser using DataLab