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 df.

Value

A summarized data.frame

Mean calculation

The calculation of the harmonic mean is as follows:

length(x)/sum(1/x)

NAs are removed before calculation

The geometric mean is given by:

prod(x)^(length(x))

but implemented as:

exp(sum(log(x[x > 0])) / length(x))

NAs 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.4.0 Index]