nmr_pca_build_model: Build a PCA on for an nmr_dataset

Description Usage Arguments Value See Also Examples

View source: R/pca_helpers.R

Description

This function builds a PCA model with all the NMR spectra. Regions with zero values (excluded regions) or near-zero variance regions are automatically excluded from the analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
nmr_pca_build_model(
  nmr_dataset,
  ncomp = NULL,
  center = TRUE,
  scale = FALSE,
  ...
)

## S3 method for class 'nmr_dataset_1D'
nmr_pca_build_model(
  nmr_dataset,
  ncomp = NULL,
  center = TRUE,
  scale = FALSE,
  ...
)

Arguments

nmr_dataset

a nmr_dataset_1D object

ncomp

Integer, if data is complete ncomp decides the number of components and associated eigenvalues to display from the pcasvd algorithm and if the data has missing values, ncomp gives the number of components to keep to perform the reconstitution of the data using the NIPALS algorithm. If NULL, function sets ncomp = min(nrow(X), ncol(X))

center

(Default=TRUE) Logical, whether the variables should be shifted to be zero centered. Alternatively, a vector of length equal the number of columns of X can be supplied. The value is passed to scale.

scale

(Default=FALSE) Logical indicating whether the variables should be scaled to have unit variance before the analysis takes place. The default is FALSE for consistency with prcomp function, but in general scaling is advisable. Alternatively, a vector of length equal the number of columns of X can be supplied. The value is passed to scale.

...

Additional arguments passed on to mixOmics::pca

Value

A PCA model as given by mixOmics::pca with two additional attributes:

See Also

Other PCA related functions: nmr_pca_outliers_filter(), nmr_pca_outliers_plot(), nmr_pca_outliers_robust(), nmr_pca_outliers(), nmr_pca_plots

Other nmr_dataset_1D functions: [.nmr_dataset_1D(), computes_peak_width_ppm(), file_lister(), files_to_rDolphin(), format.nmr_dataset_1D(), is.nmr_dataset_1D(), load_and_save_functions, new_nmr_dataset_1D(), nmr_align_find_ref(), nmr_baseline_removal(), nmr_baseline_threshold(), nmr_exclude_region(), nmr_integrate_regions(), nmr_interpolate_1D(), nmr_meta_add(), nmr_meta_export(), nmr_meta_get_column(), nmr_meta_get(), nmr_normalize(), nmr_pca_outliers_filter(), nmr_pca_outliers_plot(), nmr_pca_outliers_robust(), nmr_pca_outliers(), nmr_ppm_resolution(), plot.nmr_dataset_1D(), plot_webgl(), print.nmr_dataset_1D(), rdCV_PLS_RF_ML(), rdCV_PLS_RF(), save_files_to_rDolphin(), to_ChemoSpec(), validate_nmr_dataset_peak_table(), validate_nmr_dataset()

Examples

1
2
3
4
5
6
7
8
9
dir_to_demo_dataset <- system.file("dataset-demo", package = "AlpsNMR")
dataset <- nmr_read_samples_dir(dir_to_demo_dataset)
dataset_1D <- nmr_interpolate_1D(dataset, axis = c(min = -0.5, max = 10, by = 2.3E-4))
model <- nmr_pca_build_model(dataset_1D)

dir_to_demo_dataset <- system.file("dataset-demo", package = "AlpsNMR")
dataset <- nmr_read_samples_dir(dir_to_demo_dataset)
dataset_1D <- nmr_interpolate_1D(dataset, axis = c(min = -0.5, max = 10, by = 2.3E-4))
model <- nmr_pca_build_model(dataset_1D)

AlpsNMR documentation built on April 1, 2021, 6:02 p.m.