I'm working on a linear regression.
The error reported during construction of the regression model was:
Error: unexpected input in "reg1 <- lm(años_escolaridad ∼"
I'm working on a linear regression.
The error reported during construction of the regression model was:
Error: unexpected input in "reg1 <- lm(años_escolaridad ∼"
The error you are receiving is coming from the fact that your tilde "∼" is not the real tilde "~". Notice that the tilde you used is longer. Only the tilde with an ASCII value of 126 will succeed as a proper infix shorthand to the formula
function:
R.oo::charToInt("~")
[1] 126
R.oo::charToInt("∼")
[1] NA
I don't know how you got that false imitator but maybe you were using MS Word or some other word processing software to put in a tilde that was non-ASCII.
f <- z ~ x + y
f
#z ~ x + y Successful creation of a formula object
f2 <- z ∼ x + y
#Error: unexpected input in "f2 <- z ∼" Failure to create formula