getFres: Extract a Filter Result

Description Usage Arguments Details Value Examples

View source: R/getFres.R

Description

Extract a single summary statistic from a filterResult or flowFrame/flowSet plus filter

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getFres(
  x,
  filter,
  what = c("p", "true", "count", "n", "positive", "negative"),
  as.percent = FALSE,
  excluded = FALSE,
  fmt = "%4.1f%%"
)

get.p(x, filter, as.percent = FALSE, excluded = FALSE)

Arguments

x

Either a filterResult or a flowFrame or a flowSet

filter

An optional filter, required if x is not a filterResult

what

A single character string specifying the statistic to return. The default value of "p" extracts the positive fraction. (See the Details section for other options)

as.percent

If TRUE, return the positive fraction (or negative fraction) as a formatted character string

excluded

If TRUE, return the negative fraction or negative population

fmt

Character format string for sprintf if the argument as.percent = TRUE

Details

This function will extract a selected statistic from a filter result. If needed, it will apply a filter to a flowFrame or flowSet and then extract the desired statistic. The positive or negative population can be specified.

This is a convenience function to extract information normally produced by sequentially calling filter, summary and an extraction function to retrieve slot values. The extracted statistic is either the positive fraction (p), positive number (true) or total number (count).

If the first argument (x) is a filterResult or filterResultList, the argument filter is ignored unless it is a single character string that will be interpreted as what. This allows for lazy applications of the function to filter results such as getFres(res, "n") to extract the total number of events from the object res. If the first argument is a flowFrame or flowSet, filter must be provided in order to apply it to the data before extracting the statistic.

The specific statistic can be specified by the character value in what as indicated below:

"p" The positive fraction of events.
"true" Number of positive events.
"positive" Number of positive events.
"negative" Number of negative events.
"n" Total number of events.
"count" Total number of events.

Note that with what = "n" or what = "count", the excluded option is ignored.

Value

For getFres: a numeric vector of the desired statistic or a character string formatted as the percent of positive or negative events.

For get.p: a numeric vector of the positive fraction, or a character string formatted as the percent positive events.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 fs <- readSet(system.file("extdata", "synch/", package = "flowExtra"))
 fs <- fs[c(3, 7, 11, 15)]
 res <- filter(fs, norm2Filter("FSC.H", "SSC.H", scale.factor = 2))
 xyplot(SSC.H ~ FSC.H, fs, filter = res, stats = TRUE)
 getFres(res, as.percent = TRUE)
 getFres(res) # default format
 getFres(res, "n")
 getFres(res, "true")
 getFres(res, "negative")
 getFres(res, "p", as.percent = TRUE, excluded = TRUE)
 

ornelles/flowExtra documentation built on March 1, 2020, 9:33 a.m.