Implementation of dplyr::mutate() that allows to modify cell data.frames of the cypro object.

mutateClusterDf(object, ..., group_by = NULL, phase = NULL)

mutateMetaDf(object, ..., group_by = NULL, phase = NULL)

mutateStatsDf(object, ..., group_by = NULL)

Arguments

object

A valid cypro object.

...

Name-value pairs according to the syntax of dplyr::mutate(). This can be single or several expressions as well as usage of dplyr::across() if several variables are supposed to be affected. See details for output requirements.

group_by

Character vector or NULL. If character, denotes the grouping variables according to which the cell data.frame is grouped via dplyr::group_by() prior to the call to dplyr::mutate().

phase

Character or numeric. If character, the ordinal value referring to the phase of interest (e.g. 'first', 'second' etc.). referring to the phase of interest or 'all'. If numeric, the number referring to the phase.

If set to NULL takes the phase denoted as default with adjustDefault().

Ignored if the experiment design contains only one phase.

Value

An updated version of the input cypro-object.

Details

Process:

The data.frame that is given to dplyr::mutate() contains all variables from slots cluster, meta, stats and well_plate. Meaning that you can refer to variables from slot cluster or well plate, for instance, if you want to mutate the stats data.frame. Prior to setting the mutated data.frame back in its original slot data variables from other slots are removed.

Output requirements to ensure the cypro objects integrity:

Protected variables such as cell_id, cell_line, condition, well_plate_name etc. must not be changed. Attempts result in an error message.

In case of the stats data.frame new variables must be numeric. In case of the other three slots new variables must be of class factor or character. The latter is converted to factor automatically.

Discarding variables with e.g. cluster_variable_x = NULL is not allowed. Use the discard*()-functions for that matter.