View source: R/mutate_sample_zero.R
mutate_sample_zero_number | R Documentation |
This function adds a new column to the sample_info
slot of a mass_dataset object,
which contains the number of zero values for each sample according to the variables specified.
mutate_sample_zero_number(object, according_to_variables = "all")
object |
A mass_dataset object. |
according_to_variables |
A character vector specifying the variable IDs to consider when calculating the number of zero values. Default is "all", which considers all variables. |
A modified mass_dataset object with an updated sample_info
slot.
Xiaotao Shen shenxt1990@outlook.com
data("expression_data")
data("sample_info")
data("variable_info")
object =
create_mass_dataset(
expression_data = expression_data,
sample_info = sample_info,
variable_info = variable_info
)
object
##calculate NA number according to all the variables
object2 =
mutate_sample_zero_number(object = object)
colnames(extract_sample_info(object))
colnames(extract_sample_info(object2))
object2@sample_info_note
##calculate NA number according to only variables with mz > 100
variable_id =
object2 %>%
activate_mass_dataset(what = "variable_info") %>%
filter(mz > 100) %>%
pull(variable_id)
object3 =
mutate_sample_zero_number(object = object2,
according_to_variables = variable_id)
object3
head(extract_sample_info(object3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.