Help on PCA: Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric June 27, 2019, 02:48:51 PM Hi,Any body knows how to solve this R PCA problem? I`ve try many times, I still don`t know the reason. I hope somebody could help meWhen I type:> dtp<-prcomp(tdt,retx= TRUE,center= TRUE,scale= TRUE)Error in colMeans(x, na.rm = TRUE) : 'x' must be numericThanks in advance for all your help. Last Edit: June 27, 2019, 03:07:14 PM by genefisher

Re: Help on PCA: Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric Reply #1 – June 28, 2019, 08:31:50 AM Hello,One of your columns contains non-numeric information. This might be because your data frame (tdt) has a column specifying the treatment. Here is an example with the iris data set which has "Species" in column 5.data("iris")pca <- prcomp(iris) # Fails with "Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric"pca <- prcomp(iris[1:4]) # SuccessHope this helps. 2 Likes