“prediction” function in R – Error in nn$covariate

Below is an error that I faced while using CART, Random Forest and Neural Network in the same R session.

Error message:
Error in nn$covariate : $ operator is invalid for atomic vectors

Reason:
This error occurs when you try to use “prediction” function in R while “neuralnet” library is attached. They both seem to clash.

Fix:
Simply detach the neural net library using command
detach(package:neuralnet)

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s