# Create some data
x <- data.frame(
time = rep(seq.POSIXt(as.POSIXct("2021-11-14 13:00:00"), by = "1 hour", length.out = 3), 2),
participant_id = c(rep("12345", 3), rep("23456", 3)),
item_one = rep(c(40, 50, 60), 2)
)
# Create some gaps
gaps <- data.frame(
from = as.POSIXct(c("2021-11-14 13:00:00", "2021-11-14 14:00:00")),
to = as.POSIXct(c("2021-11-14 13:30:00", "2021-11-14 14:30:00")),
participant_id = c("12345", "23456")
)
# Link the gaps to the data
link_gaps(x, gaps, by = "participant_id", offset_before = 0, offset_after = 1800)
# Link the gaps to the data and include the raw data
link_gaps(
x,
gaps,
by = "participant_id",
offset_before = 0,
offset_after = 1800,
raw_data = TRUE
)
Run the code above in your browser using DataLab