Below is an error that I faced while using CART, Random Forest and Neural Network in the same R session.
Error in nn$covariate : $ operator is invalid for atomic vectors
This error occurs when you try to use “prediction” function in R while “neuralnet” library is attached. They both seem to clash.
Simply detach the neural net library using command
Then execute prediction function and it will work fine. I read in other forums that the same issue could be caused by other prediction packages as well. Please explore in these lines if you currently do not have neural net open.