0

I know there are several answered questions regarding this error in R. However, I was not able to find one that could help me in my case.

What I am trying to do is fit a multiple linear model in it and rounding the output that I get into 2 decimal places. However, I get this error:

error message

This is what I have used to fit the model:

sw.fit <- step(lm.fit, k = log(nrow(train)), trace = 0, direction = 'both') 

and this is what I used to round to 2 decimal places:

sw.fit<- round(sw.fit,2)

and this is the error I get:

Error in round(sw.fit, 2): non-numeric argument to mathematical function
Traceback:

Could you please help me figure out what I am doing wrong here?

I appreciate your help, thank you in advance!

0 Answers0