[R] Error in lm() function

Bogaso bogaso.christofer at gmail.com
Wed Nov 11 13:14:05 CET 2009


Hi all,

I wanted to have a seasonality study like whether a particular month has
significant effect as compared to others. Here is my data :

0.10499	0	0	1	0	0	0	0	0	0	0	0
0.00259	0	0	0	1	0	0	0	0	0	0	0
-0.06015	0	0	0	0	1	0	0	0	0	0	0
0.10721	0	0	0	0	0	1	0	0	0	0	0
0.03597	0	0	0	0	0	0	1	0	0	0	0
0.10584	0	0	0	0	0	0	0	1	0	0	0
0.02063	0	0	0	0	0	0	0	0	1	0	0
-0.03509	0	0	0	0	0	0	0	0	0	1	0
-0.03485	0	0	0	0	0	0	0	0	0	0	1
0.01632	0	0	0	0	0	0	0	0	0	0	0
0.06844	1	0	0	0	0	0	0	0	0	0	0
-0.01766	0	1	0	0	0	0	0	0	0	0	0
0.00989	0	0	1	0	0	0	0	0	0	0	0
0.11673	0	0	0	1	0	0	0	0	0	0	0
0.01789	0	0	0	0	1	0	0	0	0	0	0
-0.00323	0	0	0	0	0	1	0	0	0	0	0
0.06811	0	0	0	0	0	0	1	0	0	0	0
-0.01292	0	0	0	0	0	0	0	1	0	0	0
-0.12244	0	0	0	0	0	0	0	0	1	0	0
-0.06645	0	0	0	0	0	0	0	0	0	1	0
-0.03355	0	0	0	0	0	0	0	0	0	0	1
0.02308	0	0	0	0	0	0	0	0	0	0	0
-0.11711	1	0	0	0	0	0	0	0	0	0	0
0.06116	0	1	0	0	0	0	0	0	0	0	0
0.02832	0	0	1	0	0	0	0	0	0	0	0
0.01441	0	0	0	1	0	0	0	0	0	0	0
-0.04412	0	0	0	0	1	0	0	0	0	0	0
0.05558	0	0	0	0	0	1	0	0	0	0	0
0.08363	0	0	0	0	0	0	1	0	0	0	0
-0.01063	0	0	0	0	0	0	0	1	0	0	0

i.e. all explanatory variables here are dichotomous. However once I run lm()
i got following error :

> lm(dat[,1]~dat[,-1])
Error in model.frame.default(formula = dat[, 1] ~ dat[, -1],
drop.unused.levels = TRUE) : 
  invalid type (list) for variable 'dat[, -1]'

Can anyone please tell me what to do?

Best,

-- 
View this message in context: http://old.nabble.com/Error-in-lm%28%29-function-tp26300324p26300324.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list