Hi, 

Use print function print(Anova(...))

How about use of lappy functions ? It can be much easier

foo<-function(data,formula){
     LM <- lm(formula,data=data)
    Result<-list(LmSum<-summary(LM), Type2<-Anova(LM, 
type="II")),Type3<-Anova(LM, type="III"))
}

and print(lappy(split(data,year),foo,formula=...))
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

----- Message d'origine ----
De : Jorge Lampurlanes Castel <[EMAIL PROTECTED]>
À : r-help@stat.math.ethz.ch
Envoyé le : Mardi, 16 Janvier 2007, 13h10mn 10s
Objet : [R]  problems with for loop

Hello,

With this program I try to repeat analysis for different years. The
results of the analysis are not printed when in the loop, except for the
year sequence. What is wrong?

Thanks a lot.

for (i in 92:99){
    cat("\n",
    "=============================================================\n",
    "YEAR =",i,"\n",
    "=============================================================\n"
    )
    canos1 <- subset (canos, canos$YEAR==i)
    LinearModel.1 <- lm(MM_P  ~ BLOC  + TIL, data=canos1)
    summary(LinearModel.1)
    Anova(LinearModel.1, type="II")
    Anova(LinearModel.1, type="III")

}


-- 
**************************************************
Jorge Lampurlanés Castel
Departament d'Enginyeria Agroforestal
Escola Tècnica Superior d'Enginyeria Agrària
Universitat de Lleida
Avinguda Rovira Roure, 191
25198-LLEIDA
SPAIN

Tl.: +34 973 70 25 37
Fax.:+34 073 70 26 73
e-mail: [EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch 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.







        

        
                
___________________________________________________________________________ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internaut

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to