| add_missing_element_columns | R Documentation |
This function ensures that missing isotope columns are added to the input data table (mfd), which is required for further data evaluation that considers isotope information. If any of the specified isotope columns are not already present in the data, they will be added with a default value of 0.
The function is typically used to standardize the dataset by ensuring that all expected isotopes (e.g., nitrogen-15, carbon-13) are represented, even if they are not initially present in the data. The function works by checking for the existence of each specified isotope column and adding the missing ones.
add_missing_element_columns(mfd, missing_cols = "15n")
mfd |
data.table with molecular formula data as derived from
|
missing_cols |
A character vector of isotope column names that should be checked and added if missing. By default, it includes |
A data.table object with the missing isotope columns added,
where missing columns are populated with a default value of 0.
The original mfd object is modified in place.
Other tools:
order_columns()
# Add missing isotope columns to a demo dataset
mfd_with_isotopes <- add_missing_element_columns(mfd = mf_data_demo)
# Add a specific isotope column for Nitrogen-15 (if missing)
mfd_with_15n <- add_missing_element_columns(mfd = mf_data_demo, missing_cols = c("15n", "na"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.