I am trying to use linear regression using R. The following is my code, everything works fine except last line which gives following error: Error in .Primitive("%*%")(x, y) : requires numeric/complex matrix/vector arguments
data<-read.table("tmp.txt",header=TRUE)
X<-data$P
Y<-data$Q
plot(data, pch=16)
model <- lm(Y ~ X , data)
# make a prediction for each X
predY <- predict(model,data)