The third argument of combn
(not combn2
) takes a function that can be applied to each combination. You can simply do
combn(data, 2L, \(d) {
syms <- lapply(names(d), as.symbol)
names(syms) <- c("x", "y")
eval(bquote(t.test(.(x), .(y)), syms), d)
}, FALSE)
Output
[[1]]
Welch Two Sample t-test
data: apple and banana
t = -0.11531, df = 197.6, p-value = 0.9083
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3017470 0.2684074
sample estimates:
mean of x mean of y
-0.03961686 -0.02294705
[[2]]
Welch Two Sample t-test
data: apple and pear
t = -0.78348, df = 197.86, p-value = 0.4343
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3841981 0.1657171
sample estimates:
mean of x mean of y
-0.03961686 0.06962364
[[3]]
Welch Two Sample t-test
data: apple and orange
t = -0.55681, df = 196.65, p-value = 0.5783
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3433412 0.1921482
sample estimates:
mean of x mean of y
-0.03961686 0.03597966
[[4]]
Welch Two Sample t-test
data: apple and pineapple
t = 0.038627, df = 197.99, p-value = 0.9692
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2739606 0.2849074
sample estimates:
mean of x mean of y
-0.03961686 -0.04509027
[[5]]
Welch Two Sample t-test
data: banana and pear
t = -0.64848, df = 196.99, p-value = 0.5174
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3740876 0.1889462
sample estimates:
mean of x mean of y
-0.02294705 0.06962364
[[6]]
Welch Two Sample t-test
data: banana and orange
t = -0.4234, df = 194.84, p-value = 0.6725
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3334116 0.2155582
sample estimates:
mean of x mean of y
-0.02294705 0.03597966
[[7]]
Welch Two Sample t-test
data: banana and pineapple
t = 0.15274, df = 197.7, p-value = 0.8788
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2637425 0.3080290
sample estimates:
mean of x mean of y
-0.02294705 -0.04509027
[[8]]
Welch Two Sample t-test
data: pear and orange
t = 0.25138, df = 197.38, p-value = 0.8018
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2302948 0.2975828
sample estimates:
mean of x mean of y
0.06962364 0.03597966
[[9]]
Welch Two Sample t-test
data: pear and pineapple
t = 0.82024, df = 197.79, p-value = 0.4131
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1610834 0.3905112
sample estimates:
mean of x mean of y
0.06962364 -0.04509027
[[10]]
Welch Two Sample t-test
data: orange and pineapple
t = 0.59521, df = 196.45, p-value = 0.5524
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1875381 0.3496780
sample estimates:
mean of x mean of y
0.03597966 -0.04509027
[[1]]
Welch Two Sample t-test
data: apple and banana
t = -0.11531, df = 197.6, p-value = 0.9083
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3017470 0.2684074
sample estimates:
mean of x mean of y
-0.03961686 -0.02294705
[[2]]
Welch Two Sample t-test
data: apple and pear
t = -0.78348, df = 197.86, p-value = 0.4343
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3841981 0.1657171
sample estimates:
mean of x mean of y
-0.03961686 0.06962364
[[3]]
Welch Two Sample t-test
data: apple and orange
t = -0.55681, df = 196.65, p-value = 0.5783
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3433412 0.1921482
sample estimates:
mean of x mean of y
-0.03961686 0.03597966
[[4]]
Welch Two Sample t-test
data: apple and pineapple
t = 0.038627, df = 197.99, p-value = 0.9692
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2739606 0.2849074
sample estimates:
mean of x mean of y
-0.03961686 -0.04509027
[[5]]
Welch Two Sample t-test
data: banana and pear
t = -0.64848, df = 196.99, p-value = 0.5174
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3740876 0.1889462
sample estimates:
mean of x mean of y
-0.02294705 0.06962364
[[6]]
Welch Two Sample t-test
data: banana and orange
t = -0.4234, df = 194.84, p-value = 0.6725
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3334116 0.2155582
sample estimates:
mean of x mean of y
-0.02294705 0.03597966
[[7]]
Welch Two Sample t-test
data: banana and pineapple
t = 0.15274, df = 197.7, p-value = 0.8788
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2637425 0.3080290
sample estimates:
mean of x mean of y
-0.02294705 -0.04509027
[[8]]
Welch Two Sample t-test
data: pear and orange
t = 0.25138, df = 197.38, p-value = 0.8018
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2302948 0.2975828
sample estimates:
mean of x mean of y
0.06962364 0.03597966
[[9]]
Welch Two Sample t-test
data: pear and pineapple
t = 0.82024, df = 197.79, p-value = 0.4131
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1610834 0.3905112
sample estimates:
mean of x mean of y
0.06962364 -0.04509027
[[10]]
Welch Two Sample t-test
data: orange and pineapple
t = 0.59521, df = 196.45, p-value = 0.5524
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1875381 0.3496780
sample estimates:
mean of x mean of y
0.03597966 -0.04509027
[[1]]
Welch Two Sample t-test
data: apple and banana
t = -0.11531, df = 197.6, p-value = 0.9083
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3017470 0.2684074
sample estimates:
mean of x mean of y
-0.03961686 -0.02294705
[[2]]
Welch Two Sample t-test
data: apple and pear
t = -0.78348, df = 197.86, p-value = 0.4343
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3841981 0.1657171
sample estimates:
mean of x mean of y
-0.03961686 0.06962364
[[3]]
Welch Two Sample t-test
data: apple and orange
t = -0.55681, df = 196.65, p-value = 0.5783
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3433412 0.1921482
sample estimates:
mean of x mean of y
-0.03961686 0.03597966
[[4]]
Welch Two Sample t-test
data: apple and pineapple
t = 0.038627, df = 197.99, p-value = 0.9692
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2739606 0.2849074
sample estimates:
mean of x mean of y
-0.03961686 -0.04509027
[[5]]
Welch Two Sample t-test
data: banana and pear
t = -0.64848, df = 196.99, p-value = 0.5174
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3740876 0.1889462
sample estimates:
mean of x mean of y
-0.02294705 0.06962364
[[6]]
Welch Two Sample t-test
data: banana and orange
t = -0.4234, df = 194.84, p-value = 0.6725
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.3334116 0.2155582
sample estimates:
mean of x mean of y
-0.02294705 0.03597966
[[7]]
Welch Two Sample t-test
data: banana and pineapple
t = 0.15274, df = 197.7, p-value = 0.8788
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2637425 0.3080290
sample estimates:
mean of x mean of y
-0.02294705 -0.04509027
[[8]]
Welch Two Sample t-test
data: pear and orange
t = 0.25138, df = 197.38, p-value = 0.8018
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.2302948 0.2975828
sample estimates:
mean of x mean of y
0.06962364 0.03597966
[[9]]
Welch Two Sample t-test
data: pear and pineapple
t = 0.82024, df = 197.79, p-value = 0.4131
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1610834 0.3905112
sample estimates:
mean of x mean of y
0.06962364 -0.04509027
[[10]]
Welch Two Sample t-test
data: orange and pineapple
t = 0.59521, df = 196.45, p-value = 0.5524
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-0.1875381 0.3496780
sample estimates:
mean of x mean of y
0.03597966 -0.04509027