2016-05-04 279 views
1

我试着去得到一个TukeyHSD到R中运行,我的代码看起来是这样的:TukeyHSD具体条件

#----------------------------------------------------------------------------------------# 
# RING data: 
#----------------------------------------------------------------------------------------# 
library(doBy) 
# Set working directory 
setwd("") 

#### Read data & Converting factors #### 
dat <- read.table("afstand.txt", header =TRUE) 
str(dat) 
dat$Vial <- as.factor(dat$Vial) 
dat$Line <- as.factor(dat$Line) 
dat$Fly <- as.factor(dat$Fly) 
dat$Temp <- as.factor(dat$Temp) 
str(dat) 

datSUM <- summaryBy(X0.5_sec+X1_sec+X1.5_sec+X2_sec+X2.5_sec+X3_sec~Vial_nr+Concentration+Sex+Line+Vial+Temp,data=dat, FUN=sum) 
fl<-levels(datSUM$Line) 
aov1 <- aov(X0.5_sec.sum ~ Concentration*Sex*Line*Temp, data=datSUM) 
summary(aov1) #Overview of model 
TukeyHSD(aov1, 'Line',ordered = TRUE, conf.level = 0.95) 

我想要做的就是看线路和温度的实例之间的相互作用,但如果我运行TukeyHSD(aov1)然后我得到所有的相互作用,导致这个错误:[ reached getOption("max.print") -- omitted 3716 rows ]有没有一种方法,我可以指定我只想测试线和温度之间,而不是所有的组合,或只显示重要结果的方式只需运行TukeyHSD(avo1)? 我试过使用TukeyHSD(aov1, 'Line,Temp',ordered = TRUE, conf.level = 0.95)TukeyHSD(aov1, 'Line':'Temp',ordered = TRUE, conf.level = 0.95)TukeyHSD(aov1, 'Line'&'Temp',ordered = TRUE, conf.level = 0.95)但没有运气。

structure(list(Concentration = structure(c(2L, 7L, 7L, 1L, 7L, 
1L, 2L, 1L, 7L, 1L, 4L, 2L, 2L, 1L, 2L, 4L, 7L, 2L, 2L, 1L), .Label = c("a", 
"b", "c", "d", "e", "x", "y"), class = "factor"), Sex = structure(c(1L, 
2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 
1L, 2L, 1L), .Label = c("f", "m"), class = "factor"), Line = structure(c(3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
3L, 3L, 3L), .Label = c("20", "23", "40", "73"), class = "factor"), 
    Temp = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L), .Label = c("23", 
    "29"), class = "factor"), X0.5_sec.sum = c(107.19, 46.17, 
    58.05, 75.87, 87.75, 71.55, 46.17, 47.25, 22.41, 31.05, 27.36, 
    79.11, 87.58, 21.33, 34.29, 60.4, 85.05, 72.47, 114.21, 67.77 
    )), .Names = c("Concentration", "Sex", "Line", "Temp", "X0.5_sec.sum" 
), row.names = c(NA, 20L), class = "data.frame") 
+2

如果没有可复制的代码,很难提供帮助,但也许你应该在呼叫中包含'which = c(“Line”,“Temp”)'。 – mtoto

+0

我已经添加了代码的dput20。我也尝试过'which = c(“Line”,“Temp”)'但是这个dosent将它们结合起来,它只是并排运行它们 –

+0

替换,在你的建议中解决了问题,谢谢! –

回答

1

变量之间只显示交互LineTemp,你可以按如下方式指定的参数which

which = 'Line:Temp' 

,然后将你的完整的函数调用TukeyHSD到:

TukeyHSD(aov1, 'Line:Temp', ordered = TRUE, conf.level = 0.95) 
+0

非常感谢!有没有办法只显示重要的结果? –