Skip to content
Prev 295141 / 398506 Next

for loop, error in model frame.default ... variable lengths differ

On May 21, 2012, at 10:25 , Petr PIKAL wrote:

            
colnames(df)[i] is a character vector of length 1. This doesn't work any better than
Error in model.frame.default(formula = colnames(airquality[1]) ~ Month,  : 
  variable lengths differ (found for 'Month')

What the poster probably wanted was something in the vein of
Month    Ozone
1     5 23.61538
2     6 29.44444
3     7 59.11538
4     8 59.96154
5     9 31.44828