#' Merge videos
#'
#' Merges data sets for consecutive videos for each animal.
#'
#' @param df_list List of data frames
#'
#' @import dplyr
#' @importFrom utils tail
#' @return Merged data frame from list
#' @export
#'
merge_videos <- function(df_list) {
for (i in 1:length(df_list)) {
max_time <- utils::tail(df_list[[i]]$time, 1)
if (levels(df_list[[i]]$vid) == 2) {
df_list[[i]] <- df_list[[i]] %>%
mutate(time = .data$time + max_time)
}
}
df <- bind_rows(df_list) %>%
arrange(.data$id, .data$time)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.