Error in eval(predvars, data, env) : object not found

data <- read.csv("/cloud/project/pygmalion.csv")
data$Treatment <- as.factor(data$Treatment)

mod.full = lm(data=data, IQ8 ~ IQPre + Treatment)

treatment.predict = factor(c("treatment","no treatment"), levels=c("treatment","no treatment"))
iqpre.predict = rep(mean(data$IQPre), 2)
data.predict = data.frame(treatment=treatment.predict, iqpre=iqpre.predict)

adjmeans = predict(data.predict)

>> Error in eval(predvars, data, env) : object 'IQPre' not found <<

Error in eval(predvars, data, env) : object 'IQPre' not found

The error message here is telling you that in the line mod.full = lm(data=data, IQ8 ~ IQPre + Treatment), R can't find the object IQPre.

Since you set up that linear regression function call to refer to the table "data", My best guess is that table doesn't have a column named IQPre. Double check it's there, and how it's spelled (R is case sensitive).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.