Skip to contents

Create, modify, and delete columns.

Usage

# S3 method for flowFrame
mutate(.data, ...)

Arguments

.data

A flowFrame

...

Name-value pairs. The name (the left side of the equals sign) gives the name of the column in the output. The right side of the equation performs computations using the names of each channel according to featureNames. Supports tidyselection.

Value

A flowFrame. The output has the following properties: * Columns from .data will be preserved according to the .keep argument. * Existing columns that are modified by ... will always be returned in their original location. * New columns created through ... will be placed according to the .before and .after arguments. * The number of rows is not affected. * Columns given the value NULL will be removed.

Examples

my_flowframe <-
  simulate_cytometry_data()$flowframe |>
    dplyr::mutate(
      random_group =
        sample(
          c("a", "b"),
          size = nrow(simulate_cytometry_data()$flowframe),
          replace = TRUE
        )
    )

 my_flowframe |>
   dplyr::mutate(new_feature = feature_1 + feature_2)
#> flowFrame object 'V1'
#> with 100 cells and 12 observables:
#>              name         desc     range  minRange  maxRange
#> $P1     feature_1    feature_1       101         0       100
#> $P2     feature_2    feature_2       100         0        99
#> $P3     feature_3    feature_3       101         0       100
#> $P4     feature_4    feature_4       101         0       100
#> $P5     feature_5    feature_5       101         0       100
#> ...           ...          ...       ...       ...       ...
#> $P8     feature_8    feature_8        98         0        97
#> $P9     feature_9    feature_9       100         0        99
#> $P10   feature_10   feature_10       100         0        99
#> $P11 random_group random_group         3         0         2
#> $P12  new_feature  new_feature       198         0       197
#> 102 keywords are stored in the 'description' slot