Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Specifying column number in Principal Component Analysis in R

I am carrying out PCA in R. Instead of carrying out PCA from Columns 7-30, I want to select Column number 4 and 15-30. How can I adjust the columns in the code

clim_data <- read.csv("MergedCSV_43X47Y_CanESM.csv")
str(clim_data)
colSums(is.na(clim_data))
numerical_data <- clim_data[,7:30]
head(numerical_data)
data_normalized <- scale(numerical_data)
head(data_normalized)
corr_matrix <- cor(data_normalized)
ggcorrplot(corr_matrix)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

to select specific columns you could specify using c() :

numerical_data <- clim_data[,c(4,15:30)]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading