I'm using SAS for my statistical purpose and I'm triyng to jump in the R' world. How can i implement Tukey linear test in R? In sas-code my lines are : PROC GLM; BY PARCELLA; CLASS TESI; MODEL PROD=TESI; MEANS TESI/TUKEY lines; IN R: ab<-type.convert(a$tesi) a<-cbind(a,ab) cc<-anova(lm(prod~ab,data=a)) cc2<-aov(prod~ab,data=a) tt<-TukeyHSD(cc2,ordered=TRUE) but how can I put the option lines that i find in sas (MEANS TESI/TUKEY lines) in R language? My output in sas is this and I wanna have the same in R. Thank you... Ivan General Linear Models Procedure Tukey's Studentized Range (HSD) Test for variable: PROD NOTE: This test controls the type I experimentwise error rate, but generally has a higher type II error rate than REGWQ. Alpha= 0.05 df= 98 MSE12.43238 Critical Value of Studentized Range= 4.486 Minimum Significant Difference= 4.5893 WARNING: Cell sizes are not equal. Harmonic Mean of cell sizes= 11.88 Means with the same letter are not significantly different. Tukey Grouping Mean N TESI A 11.788 12 R_GALA_TENROY A B A 8.385 12 MONDIAL_GALA B A B A 8.124 12 R_GALA_TENFOR B B 7.134 12 GALAXY B B C 6.301 12 ROYAL_GALA B C B C D 4.874 12 OBROGALA B C D B C D 3.864 11 BROOKFIELD C D C D 1.713 12 REDGALA95 D D 1.238 12 SCHNIGA