Error in Unused Arguments

Hi all,

I have been using the example from this website without any issue at all:

However there is now an error.

Here is a code snippet of the problem, once the BreastTissue data is loaded.

# Training the multinomial model
multinom_model <- multinom(Class ~ ., data = tissue)

# Predicting the values for train dataset
train$ClassPredicted <- predict(multinom_model, newdata = train, "class")

Error Message below:

Error in predict(multinom_model, newdata = train, "class") : 
  unused arguments (newdata = train, "class")

It is no longer working and I have tried to delete the current version and go back a couple of versions with R studio to see if that would fix the problem, but still no luck. Very strange. Any guidance on how to solve an issue like this?

Thank you.

Let's confirm that objects are what you expect. What is the result of


I think the result should include nnet.formula.

What is the result of

train$ClassPredicted <- predict.nnet(multinom_model, newdata = train, type = "class")

I ran the following.

Result of



[1] "multinom" "nnet"    

and the result of

train$ClassPredicted <- predict.nnet(multinom_model, newdata = train, type = "class")


Error in predict.nnet(multinom_model, newdata = train, type = "class") : 
  could not find function "predict.nnet"

If you run


is package::nnet in the returned values?

yes "package:nnet" is returned in the list



show anything related to nnet?

It does. Thank you FJCC.
Endless hours later... after clearing the workspace it is now working.
Still strange as I would have expected that to work after deleting R and reinstalling etc.
I do appreciate your input.

This topic was automatically closed 7 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.