nmr_meta_add | R Documentation |
This is useful to add metadata to datasets that can be later used for plotting spectra or further analysis (PCA...).
nmr_meta_add(nmr_data, metadata, by = "NMRExperiment")
nmr_meta_add_tidy_excel(nmr_data, excel_file)
nmr_data |
an nmr_dataset_family object |
metadata |
A data frame with metadata to add |
by |
A column name of both the |
excel_file |
Path to a tidy Excel file name. The Excel can consist of multiple sheets, that are added sequentially. The first column of the first sheet MUST be named as one of the metadata already present in the dataset, typically will be "NMRExperiment". The rest of the columns of the first sheet can be named at will. Similary, the first column of the second sheet must be named as one of the metadata already present in the dataset, typically "NMRExperiment" or any of the columns of the first sheet. The rest of the columns of the second sheet can be named at will. See the package vignette for an example. |
The nmr_dataset_family object with the added metadata
Other metadata functions:
Pipelines
,
nmr_meta_export()
,
nmr_meta_get()
,
nmr_meta_get_column()
,
nmr_meta_groups()
Other nmr_dataset functions:
nmr_meta_export()
,
nmr_meta_get()
,
nmr_meta_get_column()
Other nmr_dataset_1D functions:
[.nmr_dataset_1D()
,
format.nmr_dataset_1D()
,
get_integration_with_metadata()
,
is.nmr_dataset_1D()
,
nmr_integrate_peak_positions()
,
nmr_integrate_regions()
,
nmr_meta_export()
,
nmr_meta_get()
,
nmr_meta_get_column()
,
nmr_ppm_resolution()
,
print.nmr_dataset_1D()
Other nmr_dataset_peak_table functions:
nmr_meta_export()
,
nmr_meta_get()
,
nmr_meta_get_column()
# Load a demo dataset with four samples:
dataset <- system.file("dataset-demo", package = "AlpsNMR")
nmr_dataset <- nmr_read_samples_dir(dataset)
# At first we just have the NMRExperiment column
nmr_meta_get(nmr_dataset, groups = "external")
# Get a table with NMRExperiment -> SubjectID
dummy_metadata <- system.file("dataset-demo", "dummy_metadata.xlsx", package = "AlpsNMR")
NMRExp_SubjID <- readxl::read_excel(dummy_metadata, sheet = 1)
NMRExp_SubjID
# We can link the SubjectID column of the first excel into the dataset
nmr_dataset <- nmr_meta_add(nmr_dataset, NMRExp_SubjID, by = "NMRExperiment")
nmr_meta_get(nmr_dataset, groups = "external")
# The second excel can use the SubjectID:
SubjID_Age <- readxl::read_excel(dummy_metadata, sheet = 2)
SubjID_Age
# Add the metadata by its SubjectID:
nmr_dataset <- nmr_meta_add(nmr_dataset, SubjID_Age, by = "SubjectID")
# The final loaded metadata:
nmr_meta_get(nmr_dataset, groups = "external")
# Read a tidy excel file:
dataset <- system.file("dataset-demo", package = "AlpsNMR")
nmr_dataset <- nmr_read_samples_dir(dataset)
# At first we just have the NMRExperiment column
nmr_meta_get(nmr_dataset, groups = "external")
# Get a table with NMRExperiment -> SubjectID
dummy_metadata <- system.file("dataset-demo", "dummy_metadata.xlsx", package = "AlpsNMR")
nmr_dataset <- nmr_meta_add_tidy_excel(nmr_dataset, dummy_metadata)
# Updated Metadata:
nmr_meta_get(nmr_dataset, groups = "external")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.