tidy_PCA: PCA on tidy (long-format) data

Description Usage Arguments Details Value Author(s)

View source: R/tidy_PCA_biplot.R

Description

PCA on tidy (long-format) data. With this data you don't need to create a matrix to calculate PCA. Your data needs to be in long format with columns identifying the samples and the variables.

Usage

1
2
tidy_PCA(data, sample_col, var_col, value_col, pc_max = 2, scale = "uv",
  method = "nipals")

Arguments

data

Numerical matrix with (or an object coercible to such) with samples in rows and variables as columns. Can also be a data frame in which case all numberic variables are used to fit the PCA.

sample_col

Bare column name for the column defining the samples

var_col

Bare column name for the column defining the variables

value_col

Bare column name for the column defining the values

pc_max

A scalar giving the number of principal components to calculate.

scale

Scaling, see prep. One of "none", "pareto", "vector" or "uv".

method

One of the methods reported by pcaMethods::listPcaMethods().

Details

This function is wrapper function for pca.

the following set of pca methods are available:

svd:

Uses classical prcomp. See documentation for svdPca.

nipals:

An iterative method capable of handling small amounts of missing values. See documentation for nipalsPca.

rnipals:

Same as nipals but implemented in R.

bpca:

An iterative method using a Bayesian model to handle missing values. See documentation for bpca.

ppca:

An iterative method using a probabilistic model to handle missing values. See documentation for ppca.

svdImpute:

Uses expectation maximation to perform SVD PCA on incomplete data. See documentation for svdImpute.

Scaling and centering is part of the PCA model and handled by prep.

Value

The original data.frame in addition to scores and loadings columns.

Author(s)

Jan Stanstrup, [email protected].


stanstrup/Rplot.extra documentation built on Nov. 30, 2017, 11:50 p.m.