R/merge_flowSet_abstime.R

Defines functions merge_flowSet_abstime

Documented in merge_flowSet_abstime

#' Merge a flowSet into a dataframe
#'
#' This function takes a flowSet object created by the read.flowSet function from the flowCore package
#' @param fs The flowset to be merged
#' @param rename.cols whether or not to rename the columns of the dataframe to short channel names; default is TRUE
#' @param method the method for renaming columns; will only be used if rename.cols = TRUE; default is "old"
#' @export
#' @return a tidy dataframe of flow cytometry data; rows are observations, columns are channels; the identifier column is by default the name of the fcs file and is called 'exp'

merge_flowSet_abstime <- function(fs, rename.cols = T, method = "old"){
  df <- plyr::rename(plyr::ldply(fsApply(fs, build_ff_df_w_abstime, simplify = FALSE)), c(".id" = "exp")) %>%
    select(-exp, everything())
  if (rename.cols == T) {
    df <- rename_fcs_cols2(df, method = method)
    return(df)
  } else {
    return(df)
  }
}
ctriandafillou/flownalysis documentation built on Sept. 7, 2020, 1:48 a.m.