Reputation: 13
How do I apply a function so it will count the number of times 0 is between the upper and lower bound for both? I think I should use findInterval
for Tukey's but am confused as how to apply.
tuke=function(I,J){
a=rnorm(I*J)
b=c(rep(letters[c(1:I)],each=J))
q=data.frame(a,b)
test.factors=q[,2]
aov1=aov(q[,1]~test.factors)
summary(aov1)
multicom=TukeyHSD(aov1,"test.factors")
return(list(summary(aov1),multicom,plot(multicom)))}
Upvotes: 0
Views: 600
Reputation: 180
I find the question difficult to understand, but could this code help please?
l1 <- c(-1, 2, -3, -4)
u1 <- c(2, 3, 1, 5)
l2 <- c(4,-2, -1, -6)
u2 <- c(5, -1, 4, 7)
l1 < 0 & u1 > 0 & l2 < 0 & u2 > 0
# [1] FALSE FALSE TRUE TRUE
sum(l1 < 0 & u1 > 0 & l2 < 0 & u2 > 0)
# [1] 2
Upvotes: 1