Hi Bogaso,
Try this
vecnames<-names(test[,2:11])
fmla <- as.formula(paste("test[,1] ~ ", paste(vecnames, collapse= "+")))
res<-lm(fmla)
Regards
M
Bogaso a écrit :
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,
--
Mohamed Lajnef
INSERM Unité 955.
40 rue de Mesly. 94000 Créteil.
Courriel : mohamed.laj...@inserm.fr
tel.: 01 49 81 31 31 (poste 18470)
Sec : 01 49 81 32 90
fax : 01 49 81 30 99
Portable:06 15 60 01 62
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.