2
I try to perform the function tapply
for several variables at the same time, but using the function pairwise.t.test
. However, I do not succeed.
So I have to do this:
pairwise.t.test(seguro1$tmp_habilit,seguro1$group,method='bonferroni')
pairwise.t.test(seguro1$estciv,seguro1$group,method='bonferroni')
pairwise.t.test(seguro1$nmultas,seguro1$group,method='bonferroni')
I mean, one at a time.
dput
for assistance in response:
data=structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20), tmp_habilit = c(20, 21, 25,
25, 18, 23, 9, 12, 15, 14, 15, 10, 8, 7, 11, 10, 7, 9, 1, 3),
estciv = c(3, 3, 3, 2, 2, 1, 3, 2, 1, 2, 1, 3, 2, 2, 1, 2,
2, 1, 3, 1), nmultas = c(1, 0, 2, 3, 2, 2, 6, 4, 3, 2, 5,
5, 4, 13, 15, 9, 6, 10, 8, 5), group = structure(c(2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L,
3L, 3L, 3L), .Label = c("2", "1", "3"), class = "factor"),
group1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("1",
"2", "3"), class = "factor")), .Names = c("id", "tmp_habilit",
"estciv", "nmultas", "group", "group1"), row.names = c(NA, -20L
), class = "data.frame")
The intention is not to have to type pairwsise.t.test
several times (for each group). It is possible to apply tapply
in this example?
Corrigendum: is not
method='bonferroni'
and yesp.adj='bonferroni'
– neves