I'm a biologist, not a programmer so please be gentle.
So I have a dataset that looks like
Genes Patient1 Patient2 Patient3
A 324 433 343
B 431 342 124
Z 232 234 267
then I have the sample sheet where it contains sample info like:
Patient1 - Healthy
Patient2 - Disease
Patient3 - Healthy
(110 samples)
I am using:
library(ggfortify)
df <- dataset
pca_res <- prcomp(df, scale. = TRUE)
autoplot(pca_res)
Then I want to do
autoplot(pca_res, data = ?, colour = '?')
I wish to use the info from the sample sheet to colour my PCA based on the state (healthy/disease) using the autoplot function. Is there a way to do this?