addMetaDataObs | R Documentation |
This function adds metadata variables from a given data frame to an object, aligning the data with existing observations.
addMetaDataObs(
object,
meta_obs_df,
var_names = NULL,
na_warn = TRUE,
overwrite = FALSE
)
object |
An object of class |
meta_obs_df |
A data frame containing new metadata variables to be added.
This data frame must contain a column named |
var_names |
A character vector specifying which columns from |
na_warn |
Logical value indicating whether to issue warnings if NAs are
introduced in the new metadata variables. Default is |
overwrite |
Logical value. Must be |
The input meta_obs_df
must satisfy the following requirements:
It must be a data frame.
It must contain a column named barcodes
, which will be used as the key for merging the metadata variables with the existing observations.
Any other columns can represent the metadata variables to be added. These columns must not be named "barcodes" or "sample".
The columns specified in var_names
must be present in meta_obs_df
.
The function checks for the existence of the specified metadata variables in the object.
If overwrite
is FALSE
, it ensures that no existing variables are overwritten.
If NAs are introduced in the new metadata variables, warnings will be issued if na_warn
is TRUE
.
The updated input object, containing the added, removed or computed results.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.