[R] Constant Error in R

Jim Holtman jholtman at gmail.com
Wed Oct 10 12:37:56 CEST 2012


learn how to debug your program.  I think the call is:

options(error = recover)

don't have R on my iPad so cannot check.  When you do this, you drop into the 'browser' at which point you can examine the value and see that you have a non-numeric object.

Sent from my iPad

On Oct 10, 2012, at 6:12, S Ellison <S.Ellison at lgcgroup.com> wrote:

>> 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}}
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list