(Happy Easter)
I have been trying to work out a PDDP algorithm in R, and I keep running into a single, small error while using the princomp
function. Here is the error statement:
Error in cov.wt(z) : 'x' must contain finite values only
From some cursory research, this error comes up whenever there are NA or undefined values in the data in the princomp
function. However, the data I am using (wikipedia's iris data) has no NA's in it. This is the line of code with the princomp
in it:
pr <- princomp(data[iIndexes,], scores = TRUE, na.action = na.exclude)
From my research, I was told this the standard na.action
value (na.omit) is currently bugged, so I was recommended to use na.exclude instead. I was also suggested to include a function as the first parameter, but this did not change the error message either.
Here is where I got that information: Omit NA and data imputation before doing PCA analysis using R
Let me know if you need the rest of the code in context. Thanks
Edit: As requested, here is the output of dput(data[iIndexes,])
:
structure(c(36L, 19L, 10L, 6L, 32L, 52L, 8L, 28L, 2L, 20L, ...), .Label =
c("4.3,3,1.1,0.1", "4.4,2.9,1.4,0.2", "4.4,3,1.3,0.2", "4.4,3.2,1.3,0.2", ...),
class = "factor")
The ellipses are further sets of data which are similar to the rest, 150 samples each.