R/join_flyPAD_data.R

Defines functions join_flyPAD_data

Documented in join_flyPAD_data

#' join_flyPAD_data
#'
#' @param data imported flypad data from import_flyPAD()
#'
#' @return list containing 2 data frames with sips and activity_bouts of all joint experiments
#' @export
#'
#' @examples
join_flyPAD_data <- function(data) {
  for(i in names(data)) {
    data[[i]]$activity_bouts$experiment <- i
    data[[i]]$sips$experiment <- i
  }
  sips   <- do.call("rbind", lapply(data, "[[", c("sips")))
  activity_bouts <- do.call("rbind", lapply(data, "[[", c("activity_bouts")))
  return(list(sips = sips, activity_bouts = activity_bouts))
}
Dahaniel/flyPADr documentation built on May 26, 2019, 7:24 a.m.