Hi
is it possible to read several FCS files using the purrr package instead of making a loop function like so:
for (f in files) {
name= str_split(f, "_")[[1]][2]
data_FC_sample <- flowCore::exprs(flowCore::read.FCS(filename = paste0("data/_raw/CD8_gated_files/",f),
transformation = FALSE,
truncate_max_range = FALSE))
data_FC_sample <- data_FC_sample %>%
as.tibble() %>%
mutate(name = name)
data_FC <- data_FC %>%
bind_rows(data_FC_sample)
}
when using the map function I get different errors
covid_files = list.files(path = "data/raw/CD8_gated_files/")
covid_data = map(covid_files, read.FCS)
Error:
Error in .f(.x[[i]], ...) : 'export_AP0201_CD8+.fcs' is not a valid file
or
covid_data = map(read.FCS(covid_files, transformation = FALSE,
truncate_max_range = FALSE))
Error:
Error in as_mapper(.f, ...) : argument ".f" is missing, with no default
When running the read.FCS (from the flowCore package) on single files is saved as a "flowFrame"