Error in eval(predvars, data, env) : invalid 'envir' argument of type 'character'

i wrote a multilinear regression model this way
m51 <- lm( voting.in.2017.National.elections ~ e.po.15,e.po.16,e.po.17,e.po.18,e.po.19,e.po.20,e.po.21,e.po.22,e.po.23,e.po.24,e.po.25,e.po.26,e.po.27,e.po.28,
e.po.29,e.po.30,e.po.31,e.po.32,e.po.33,e.po.34,e.po.35,e.po.36 , data = "dat")
summary(m51)

one i started to implement it i got this error
Error in eval(predvars, data, env) :
invalid 'envir' argument of type 'character'

any ideas what is this error and how to fix it ? thank you so much

i have to say i tried to do the model with one variable of the above and it was ok but once i added a second variable i got the previous error msg again

I can't tell fore sure if this is the only cause, since you are not providing a REPRoducible EXample (reprex), but you are supposed to pass a dataframe as data argument, not a character string (i.e. dat instead of "dat").

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.