I am trying to use featurePlot of caret in R.

This is the code I am using:

trellis.par.set(theme = col.whitebg(), warn = FALSE) 
caret::featurePlot(x = df[, 3:6], 
            y = df$ud, 
            plot = "scatter")

where all the columns of df[, 3:6]are of numeric type, while df$ud is a binary factor.

I also have installed the library ellipse as suggested elsewhere.

However, I keep getting NULL.

Any idea why?

  • $\begingroup$ Take a look at help(featurePlot) in caret for the expected class of the argument, x, which is a matrix $\endgroup$ – Richard Careaga Nov 7 '19 at 5:48

I had this problem due to my y variable not being a factor which is required. call:


make sure it is not interpreting the binary as character or numeric but indeed ad a factor.

| improve this answer | |

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.