[R] Constant Error in R

bobo blezaic2 at gmail.com
Tue Oct 9 23:30:10 CEST 2012


Hi good R folks,

I am hoping that you could help me resolve this issue. I tried finding
answers online but to no avail.

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 tried reinstalling R completely and it still didn't fix the issue.

I am using the latest version and Mac 10.8.2.

Thank you!

I am posting the code where the error occurred below:

library(foreign)
library(lmtest)
library(car)

x.1 <- runif(1000,0,1)

x.2 <- rbinom(1000,1,.5)

b.1 <- 10
b.2 <- 2

mu <- 1+(x.1*b.1) + (x.2*b.2)

Z <- cbind(x.1)

gamma <- 10

sigma2 <- exp(2+Z*gamma)

y <- mu +rnorm(1000) * sqrt(sigma2)

lm.y<-lm(y~x.1+x.2)

"Error in x^2 : non-numeric argument to binary operator"

summary(lm.y)



--
View this message in context: http://r.789695.n4.nabble.com/Constant-Error-in-R-tp4645630.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list