plotPCA: Plot PCA.

Description Usage Arguments Value Examples

View source: R/predictAMR.R

Description

A function that generate PCA and dimension reduction plots.

Usage

1
plotPCA(dataframe, new_data, plot_type)

Arguments

dataframe

A dataframe with rownames representing the sample ID and each column is one of sample's antimicrobial features. If the value equals to 1, the sample has this antimicrobial feature. If the value equals to 0, the sample does not have this antimicrobial feature.

new_data

The new data of dataframe must contain columns (variables) with the same names and in the same order as the data used to compute PCA.

plot_type

The type of plot need to be generated. For individual PCA plot, using "individual". For visualizing relationship between variables, using "variables". For predict new data and its relationship with old data, using "predict".

Value

Returns the PCA plot.

Examples

1
2
3
4
5
6
7
# Example 4
# Using pca_data available with package
dim(pca_data)
data.active <- pca_data[c(1:17), c(2,9,16)]
new.active <- pca_data[c(18:20), c(2,9,16)]
resultsExample4 <- plotPCA(data.active, new.active, "predict")
resultsExample4

ClorisZhou2000/MDRClassifier documentation built on Dec. 17, 2021, 2:06 p.m.