It's hard to say without example data, but assuming that Micro is just a factor with 4 levels, and uni2 looks something like
n = 40 Micro = c('Act_Glu2', 'Act_Ala2', 'Ana_Ala2', 'NegI_Ala2')[sample(4, 40, rep=T)] Sum_Uni = rnorm(n, 5, 0.5) Sum_Uni[Micro=='Act_Glu2'] = Sum_Uni[Micro=='Act_Glu2'] + 0.5 uni2 = data.frame(Sum_Uni, Micro)
> uni2 Sum_Uni Micro 1 4.964061 Ana_Ala2 2 4.807680 Ana_Ala2 3 4.643279 NegI_Ala2 4 4.793383 Act_Ala2 5 5.307951 NegI_Ala2 6 5.171687 Act_Glu2 ...
then I think that you are actually trying to get the basic output with multiple regression:
fit = lm(Sum_Uni ~ Micro, data = uni2) summary(fit) anova(fit)
> summary(fit) Call: lm(formula = Sum_Uni ~ Micro, data = uni2) Residuals: Min 1Q Median 3Q Max -1.26301 -0.35337 -0.04991 0.29544 1.07887 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.8364 0.1659 29.157 < 2e-16 *** MicroAct_Glu2 0.9542 0.2623 3.638 0.000854 *** MicroAna_Ala2 0.1844 0.2194 0.841 0.406143 MicroNegI_Ala2 0.1937 0.2158 0.898 0.375239 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4976 on 36 degrees of freedom Multiple R-squared: 0.2891, Adjusted R-squared: 0.2299 F-statistic: 4.88 on 3 and 36 DF, p-value: 0.005996 > anova(fit) Analysis of Variance Table Response: Sum_Uni Df Sum Sq Mean Sq F value Pr(>F) Micro 3 3.6254 1.20847 4.8801 0.005996 ** Residuals 36 8.9148 0.24763 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
You can access the numbers in any of these tables, for example,
> summary(fit)$coef[2,4] [1] 0.0008536287
To view a list of what is stored in each object, use names() :
> names(summary(fit)) [1] "call" "terms" "residuals" "coefficients" [5] "aliased" "sigma" "df" "r.squared" [9] "adj.r.squared" "fstatistic" "cov.unscaled"
In addition to the found TukeyHSD() function, there are many other options for further searching for paired tests and, if desired, correcting p-values. These include pairwise.table() , estimable() in gmodels , resampling and boot packages and others ...