calc_analyte_mfi {beadplexr} | R Documentation |
Calculate the analyte intensity
Description
The mean fluorescence intensity (MFI) of the analyte
Usage
calc_analyte_mfi(
df,
.parameter,
.column_name = "analyte",
.mean_fun = c("geometric", "harmonic", "arithmetic"),
.data = NULL
)
Arguments
df |
A tidy data.frame. |
.parameter |
A character giving the name of column(s) where populations are identified. |
.column_name |
A character giving the name of the column to store the population information. |
.mean_fun |
A character giving the mean function to use. |
.data |
Deprecated. Use |
Value
A summarized data.frame
Mean calculation
The calculation of the harmonic mean is as follows:
n\frac{1}{\sum_{i=1}^n \frac{1}{x_i}}
NA
s are removed before calculation
The geometric mean is given by:
\left(\prod_{i=1}^n x_i \right)^\frac{1}{n}
but implemented as:
\frac{1}{n}\exp{\sum_{i=1}^n\log(x_i)}
NA
s are removed before calculation
Examples
library(beadplexr)
library(dplyr)
data("lplex")
df <- lplex[[1]] |>
filter(`FSC-A` > 4e5L, `FSC-A` < 6.3e5L) |>
identify_analyte(.parameter = "FL6-H",
.analyte_id = as.character(c(1:7)))
df |>
calc_analyte_mfi(.parameter = "FL2-H")
df |>
calc_analyte_mfi(.parameter = "FL2-H",
.mean_fun = "harmonic")
[Package beadplexr version 0.5.0 Index]