I was wondering how I could prevent the numeric value of object eta
in my R code below from being repeated (as it does now) in the second row of my cbind()
output and instead of that an NA
be inserted in the second row?
Here is my current cbind
output:
Df Sum Sq Mean Sq F value Pr(>F) eta
k 2 8.688793 4.3443964 5.47955 0.02038724 0.4773314
Residuals 12 9.514058 0.7928382 NA NA 0.4773314(This one is repetitive! I want `NA` here)
Here is my R code:
k = gl(3, 5, 15)
y = as.vector(unlist(mapply(FUN = rnorm, n = rep(5, 3), mean = c(4, 5, 6))))
a = anova(aov(y ~ k))
eta = a[, 2][1] / (a[, 2][1] + a[, 2][2])
cbind(a, eta)
Pretty sure eta value is being recycled. You may try
cbind(a, eta = c(eta, NA))
to avoid the recycling.