R/tidy_flow_set.R

Defines functions tidy_flow_set

Documented in tidy_flow_set

#' Apply the tidy_flow_item function to a flowSet
#'
#' This function ultimately converts a flowSet into a tidy data frame
#'
#' @param flowSet the flowset in which to convert to a tidy flow set
#'
#' @return Returns a dataframe with a row for each observation (cell) with columns for:
#' \itemize{
#' item{\code{filename}}: {the name of the sample for which the cell comes from}
#' item{\code{fluorescent-markers}}: {the same number of marker-fluorescent pairs on read
#' on the machine will show as columns in this data frame}
#' }
#' @export
#'
#' @examples tidy_flow_set(flowset_FMO_gated_data)
#'
#' @importFrom dplyr %>%
#'
tidy_flow_set <- function(flowSet){
  flow_set <- flowCore::fsApply(x = flowSet,
                                FUN = tidy_flow_item)
  flow_set <- dplyr::bind_rows(flow_set, .id = "filename")

  return(flow_set)
}
aef1004/cytotypr documentation built on Dec. 25, 2021, 8:46 a.m.