fsApply, like many of the apply-style functions in R, acts as an iterator for flowSet objects, allowing the application of a function to either the flowFrame or the data matrix itself. The output can then be reconstructed as either a flowSet, a list, or a matrix depending on options and the type of objects returned.

fsApply(x, FUN, ..., simplify=TRUE, use.exprs=FALSE)

Arguments

x

flowSet to be used

FUN

the function to be applied to each element of x

...

optional arguments to FUN.

simplify

logical (default: TRUE); if all true and all objects are flowFrame objects, a flowSet object will be constructed. If all of the values are of the same type there will be an attempt to construct a vector or matrix of the appropriate type (e.g. all numeric results will return a matrix).

use.exprs

logical (default: FALSE); should the FUN be applied on the flowFrame object or the expression values.

See also

Examples

fcs.loc <- system.file("extdata",package="flowCore") file.location <- paste(fcs.loc, dir(fcs.loc), sep="/") samp <- read.flowSet(file.location[1:3]) #Get summary information about each sample. fsApply(samp,summary)
#> FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A #> Min. 85.0000 11.0000 1.000000 1.000000 1.000000 0.0000 #> 1st Qu. 385.0000 141.0000 8.131230 12.079007 2.246790 0.0000 #> Median 441.0000 189.0000 135.164850 22.467901 5.674221 26.0000 #> Mean 491.9644 277.9105 157.794167 105.986366 8.464880 34.0766 #> 3rd Qu. 518.0000 270.0000 241.441822 50.936752 10.746078 51.0000 #> Max. 1023.0000 1023.0000 3651.741273 9910.458562 3278.121151 1023.0000 #> Min. 86.0000 25.0000 1.000000 1.000000 1.000000 0.0000 #> 1st Qu. 380.0000 141.0000 170.007762 7.233942 1.684855 34.0000 #> Median 439.0000 191.0000 289.026391 12.298262 3.924190 63.0000 #> Mean 490.9320 274.2957 353.876012 15.741184 8.454397 80.8601 #> 3rd Qu. 541.0000 287.0000 441.094101 19.282185 7.914755 102.0000 #> Max. 1023.0000 1023.0000 9560.239011 632.093392 9910.458562 1023.0000 #> Min. 86.0000 18.0000 1.000000 1.000000 1.000000 0.0000 #> 1st Qu. 375.0000 139.0000 6.208244 90.579778 1.625315 0.0000 #> Median 430.0000 180.0000 10.000000 632.093392 5.139697 0.0000 #> Mean 461.7478 250.6101 32.455961 841.672178 24.906182 4.5589 #> 3rd Qu. 493.2500 244.0000 16.399996 1357.727142 13.097473 0.0000 #> Max. 1023.0000 1023.0000 9910.458562 9910.458562 9910.458562 1023.0000 #> FL4-H Time #> Min. 1.00000 1.000 #> 1st Qu. 6.61169 122.000 #> Median 12.29826 288.000 #> Mean 140.39784 294.770 #> 3rd Qu. 33.37625 457.500 #> Max. 9821.71889 626.000 #> Min. 1.00000 1.000 #> 1st Qu. 24.58244 96.000 #> Median 42.93510 226.000 #> Mean 108.16628 233.622 #> 3rd Qu. 78.43886 363.000 #> Max. 9910.45856 504.000 #> Min. 1.00000 7.000 #> 1st Qu. 25.48297 82.000 #> Median 44.70901 197.000 #> Mean 1028.22774 209.972 #> 3rd Qu. 105.54496 333.250 #> Max. 9910.45856 464.000
#Obtain the median of each parameter in each frame. fsApply(samp,each_col,median)
#> FSC-H SSC-H FL1-H FL2-H FL3-H FL1-A FL4-H Time #> 0877408774.B08 441 189 135.1649 22.46790 5.674221 26 12.29826 288 #> 0877408774.E07 439 191 289.0264 12.29826 3.924190 63 42.93510 226 #> 0877408774.F06 430 180 10.0000 632.09339 5.139697 0 44.70901 197