[R] Constant Error in R
S Ellison
S.Ellison at LGCGroup.com
Wed Oct 10 12:12:03 CEST 2012
> I keep getting this "Error in x^2 : non-numeric argument to
> binary operator"
> using multiple different codes, ones which have been verified
> to work by my professor and other students.
I confirm the previous poster's lack of error in running the code supplied. I also agree that something strange is going on.
But the error message says you have a non-numeric argument in a binary operator. That means that i) you are using a binary operator (^ in this case) either yourself or in a function you;re calling and ii) either x or 2 is non-numeric.
Two possibilities that are siompler than recompiling:
First, are you calling the lm() you think you are? Run traceback() after the error to see where it actually occurred. You may find a user-defined function that is masking lm(). That could hang around from a previous R session if you defined one and saved the image on closing.
Second: Check the class of your input data. Then fix whichever variable should be numeric and isn't. (this is less likely as lm() returns a different error with non-numeric input).
S
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list