We should just add a PCA function that does exactly what we want in terms of calculating variances, etc, and adding data back onto the sample-info data.frame if provided.
What I imagine:
- Input is a data.frame or matrix of abundances, optional data.frame of metadata, arguments to
prcomp;
- Do PCA with provided arguments;
- Extract scores and loadings into data.frames;
- Calculate scores variances, and add the labels to the scores data.frame;
- Add scores to the metadata;
- Return a list containing:
- full pca results;
- scores data.frame;
- loadings data.frame;
- variance contributions data.frame;
We should just add a PCA function that does exactly what we want in terms of calculating variances, etc, and adding data back onto the sample-info data.frame if provided.
What I imagine:
prcomp;