Issue with missMDA error: "$ operator is invalid for atomic vector"

Hello,
I am creating a principal component analysis (PCA). A few variables in my table are 0. When I run the PCA, I get the message "Missing values are imputed by the mean of the variable: you should use the imputePCA function of the missMDA package"
After installing the missMDA package, I followed the instructions in the missMDA guide and copied the following code (my data is "ACP"):
ncomp <- estim_ncpPCA(ACP)
res.imp <- imputePCA(ACP, ncp = ncomp$ncp)
res.comp <- MIPCA(ACP, ncp = ncomp$ncp, nboot = 1000)
plot(res.comp)
This is the error I get:

ncomp <- estim_ncpPCA(ACP)
Error: $ operator is invalid for atomic vectors
I found an explanation on a forum that the code is not applicable to a vector and that it can be used only for recursive data.
When I test > is.recursive(ACP), I get "true" so the issue seems to come from somewhere else.
Still I converted my date into a data frame as follows
ACP <- as.data.frame(ACP)
res.imp <- imputePCA(ACP, ncp = ncomp$ncp)
Error in imputePCA(ACP, ncp = ncomp$ncp) :
could not find function "imputePCA"
It is still not working.
How can I fix this issue???

I have used this piece of code and it works
imputePCA(ACP, ncp = 2, scale = TRUE, method = c("Regularized","EM"),
row.w = NULL, ind.sup=NULL,quanti.sup=NULL,quali.sup=NULL,
coeff.ridge = 1, threshold = 1e-06, seed = NULL, nb.init = 1,
maxiter = 1000)
However when I run this right after:
res <- PCA(ACP[1:8,-1])
I still get the error message "In PCA(ACP[1:8, -1]) :
Missing values are imputed by the mean of the variable: you should use the imputePCA function of the missMDA package"
Although I used the imputePCA code

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.