So there is no na.action argument for the form you used, and your
'na.omit' matches 'retx'. Try
prcomp(~ ., data=ot, na.action=na.omit, scale=TRUE)
or
prcomp(na.omit(ot), scale=TRUE)
prcomp(~V1+V2, data=d, center = TRUE, scale = TRUE, na.action = na.omit)
prcomp(na.omit(d), center = TRUE, scale = TRUE)
prcomp(na.omit(log.ir), center = TRUE, scale = TRUE)
Error in prcomp.default(na.omit(log.ir), center = TRUE, scale = TRUE) :
cannot rescale a constant/zero column to unit variance
Your problem is not PCA problem but a wider missing values trearment problem. If you're not familiar with it, please read a bit on it.
You have many opportunities:
(1) delete cases listwise or
(2) pairwise, or
(3) replace missings by mean or median. Or
(4) replace by random chosen of valid values (hot-deck approach). Or impute missings by
(5) mutual regression (with or without noise addition) approach or by a better,
(6) EM approach.
REF:
https://stats.stackexchange.com/questions/35561/imputation-of-missing-values-for-pca
http://menugget.blogspot.de/2011/11/empirical-orthogonal-function-eof.html
http://menugget.blogspot.de/2014/09/pca-eof-for-data-with-missing-values.html
https://stat.ethz.ch/pipermail/r-help/2008-January/150896.html
https://rdrr.io/r/stats/prcomp.html
标签:scale,NA,omit,prcomp,values,na,PCA,TRUE From: https://www.cnblogs.com/emanlee/p/7654356.html