I'm taking a class on R and I cannot get the professors code to work. I am trying to do a simple linear model and I run this code:
ozone<-read.table("http://www.ats.ucla.edu/stat/r/faq/ozone.csv", sep=",", header=T)
fit = lm(ozone~.,data=ozone)
summary(fit)
Which keeps giving me the following error:
Error in model.frame.default(formula = ozone ~ ., data = ozone, drop.unused.levels = TRUE) : invalid type (list) for variable 'ozone
It's really depressing as they are the first two lines of code in his lecture notes. I have also found several other forum posts on this topic (it's even listed as a common r mistake), but I am too...special to figure out how to change it.
I tried reading it as.numeric, and as a data.frame, which is what most other threads suggested, but neither worked.
~
should be the name of the dependent variable, not the name of the data frame. $\endgroup$ – mark999 Sep 25 '13 at 8:06