Error in lhs - rhs : non-numerical argument for binary operator

Asked

Viewed 68 times

0

I’m trying to run the function ...

m.ex=nls(dados$var1~y0*exp(r*dados$dias), data=dados, start = list(y0=10,r=0.005));m.ex

** ... in the data set:**

str(data)

'data.frame':   24 obs. of  2 variables:
 $ dias: int  1 1 1 10 10 10 20 20 20 30 ...
 $ var1: chr  "2.1" "4.8" "3.7" "6" ...

when executing the function, the error appears:

Error in lhs - rhs : argumento não-numérico para operador binário

What could be wrong in function?

Thank you to those who can answer and give a solution!!

  • 2

    var1 It is like Character, being that it should be with some numerical format. Try to put a dados$var1 <- as.numeric(dados$var1) before nls

  • If not, I recommend editing the question with the result of dput(head(dados)). That way other people can reproduce and help in the solution.

  • Very obg!! It worked!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.