Swap the colnames Perform some validity checks before returning the updated colnames

swap_data_cols(cols, swap_cols)

Arguments

cols

the original colname vector

swap_cols

a named list specifying the pairs to be swapped

Value

the new colname vector that has some colnames swapped

Examples

library(flowCore) data(GvHD) fr <- GvHD[[1]] colnames(fr)
#> [1] "FSC-H" "SSC-H" "FL1-H" "FL2-H" "FL3-H" "FL2-A" "FL4-H" "Time"
new <- swap_data_cols(colnames(fr), list(`FSC-H` = "SSC-H", `FL2-H` = "FL2-A"))
#> swap cols: FSC-H:SSC-H
#> swap cols: FL2-H:FL2-A
colnames(fr) <- new