1
I have this data:
df_1 <- data.frame(
x = replicate(
n = 3, expr = runif(n = 30, min = 20, max = 100), simplify = TRUE
),
y = as.factor(sample(x = 1:3, size = 30, replace = TRUE))
)
And this list:
lt_1 <- split(
x = df_1,
f = df_1[['y']]
)
names(lt_1) <- paste('df', seq_along(lt_1), sep = '_')
names(lt_1)
I want to apply the function pairwise.t.test
for each df
from this list. I tried:
for (i in lt_1) {
for (f in names(i[, 1:3])) {
print(pairwise.t.test(x = lt_1[, f], g = lt_1[['y']], p.adj = 'bonferroni'))
}
}
Error in lt_1[, f] incorrect number of Dimensions
Unsuccessful.
This function has a group argument (g
). Maybe the problem is there, I believe.
When you are applying the test, 'g' has only one factor, which makes the test impossible.
– Daniel Ikenaga
If the doubt remains with the lists we can create an example that makes sense in the context of the test. The problem was in the lists or in the test?
– Tomás Barcellos
I provided a wrong example. There’s only one factor in the lists. It’s actually a typo. You can close the question. I thank you all for your attention and forgiveness for.
– neves