0
$\begingroup$

I am using Rotation Forest in r. I have a very big list (which I can't give a sample) that has 50 attributes and 4000 rows. for every row there is a few missing values in the attributes, it supposed to be like that and I cant fill the missing values.

this is my code:

y <- list[,1]
x <- list[,2:ncol(list)]
rF <- rotationForest(x,y,K = round(ncol(x)/3),L=15)

this is the error:

Error in cov.wt(z) : 'x' must contain finite values only

from what I gathered the problem is with NA in relevance to PCA in the rotation forest.

any suggestion on what I can do?

$\endgroup$
6
  • $\begingroup$ could you try any(is.na(x))? $\endgroup$
    – Stereo
    Jan 5 '17 at 11:08
  • $\begingroup$ I know I have na, this code shows if I have NA isn't it? $\endgroup$
    – anat
    Jan 5 '17 at 12:20
  • $\begingroup$ it does, you should remove the NA's to make sure that rotationForest() works, according to the error message. $\endgroup$
    – Stereo
    Jan 5 '17 at 12:51
  • $\begingroup$ like I said, I have "NA" as an empty cell, I cant remove it because to every row has a few empty cells and it supposed to be like that, $\endgroup$
    – anat
    Jan 5 '17 at 21:32
  • $\begingroup$ PCA cannot handle missing values so you will have to see if you can substitute the missing values with, for example, the mean or the median of the attribute. But in any case the question will then be how to correctly fill missing values so you can apply PCA. $\endgroup$
    – Stereo
    Jan 5 '17 at 22:20
1
$\begingroup$

Are your variables categorical? If they are, then you do not need to remove them. You could just make new columns like NA_Variable1, which will indicate whether a NA value exists.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.