Apply a function on each pair of features
Value
a list containing the output of applying the function to each feature pair.
See ?base::mapply()
Examples
web <- randomWeb(10)
# For each feature pair, was the value for x higher than the value for y?
pairwiseApply(
X = web,
FUN = function(x, y) x > y,
MoreArgs = NULL, SIMPLIFY = FALSE, USE.NAMES = TRUE
)
#> $x_1y_1
#> [1] FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_1y_2
#> [1] FALSE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE TRUE
#>
#> $x_1y_3
#> [1] FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE FALSE TRUE
#>
#> $x_1y_4
#> [1] FALSE TRUE TRUE TRUE TRUE FALSE FALSE TRUE FALSE FALSE
#>
#> $x_1y_5
#> [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_1y_6
#> [1] FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE
#>
#> $x_1y_7
#> [1] FALSE TRUE TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE
#>
#> $x_1y_10
#> [1] FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE TRUE
#>
#> $x_1y_11
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE FALSE
#>
#> $x_1y_12
#> [1] FALSE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE
#>
#> $x_2y_1
#> [1] TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_2y_5
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE TRUE FALSE TRUE FALSE
#>
#> $x_2y_7
#> [1] FALSE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE
#>
#> $x_2y_9
#> [1] TRUE TRUE FALSE TRUE FALSE FALSE TRUE FALSE TRUE TRUE
#>
#> $x_3y_5
#> [1] FALSE TRUE TRUE FALSE FALSE TRUE FALSE TRUE TRUE FALSE
#>
#> $x_3y_6
#> [1] FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE
#>
#> $x_3y_7
#> [1] FALSE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE
#>
#> $x_3y_8
#> [1] FALSE FALSE FALSE TRUE TRUE TRUE FALSE FALSE TRUE TRUE
#>
#> $x_3y_10
#> [1] FALSE FALSE FALSE TRUE FALSE TRUE TRUE TRUE TRUE TRUE
#>
#> $x_3y_11
#> [1] FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_4y_3
#> [1] FALSE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE TRUE
#>
#> $x_4y_4
#> [1] FALSE TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE
#>
#> $x_4y_5
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_4y_6
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_4y_7
#> [1] FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE
#>
#> $x_4y_9
#> [1] TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE TRUE TRUE
#>
#> $x_4y_10
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE
#>
#> $x_4y_11
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_5y_3
#> [1] FALSE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_5y_5
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE TRUE FALSE
#>
#> $x_5y_6
#> [1] FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE
#>
#> $x_5y_9
#> [1] TRUE TRUE FALSE TRUE FALSE FALSE FALSE TRUE TRUE FALSE
#>
#> $x_5y_11
#> [1] FALSE TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_5y_12
#> [1] FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE
#>
#> $x_6y_2
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE FALSE TRUE TRUE FALSE
#>
#> $x_6y_4
#> [1] FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_6y_5
#> [1] FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_6y_7
#> [1] FALSE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_6y_8
#> [1] FALSE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
#>
#> $x_6y_11
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE FALSE
#>
#> $x_7y_1
#> [1] FALSE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE
#>
#> $x_7y_3
#> [1] FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE
#>
#> $x_7y_4
#> [1] TRUE TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE
#>
#> $x_7y_5
#> [1] FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE FALSE
#>
#> $x_7y_7
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE
#>
#> $x_7y_9
#> [1] TRUE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE
#>
#> $x_7y_11
#> [1] FALSE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE TRUE
#>
#> $x_8y_7
#> [1] FALSE FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE
#>
# Run cor.test() on each pair of features
pairwiseApply(
X = web,
FUN = function(x, y) cor.test(x, y),
MoreArgs = NULL, SIMPLIFY = FALSE, USE.NAMES = TRUE
)
#> $x_1y_1
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.2123, df = 8, p-value = 0.26
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3134075 0.8201495
#> sample estimates:
#> cor
#> 0.3939584
#>
#>
#> $x_1y_2
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.52621, df = 8, p-value = 0.613
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5048631 0.7286213
#> sample estimates:
#> cor
#> 0.1829038
#>
#>
#> $x_1y_3
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.36517, df = 8, p-value = 0.7244
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7011451 0.5455645
#> sample estimates:
#> cor
#> -0.1280458
#>
#>
#> $x_1y_4
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.19595, df = 8, p-value = 0.8495
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5860147 0.6696007
#> sample estimates:
#> cor
#> 0.06911177
#>
#>
#> $x_1y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.2863, df = 8, p-value = 0.2343
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.2916716 0.8278300
#> sample estimates:
#> cor
#> 0.4139796
#>
#>
#> $x_1y_6
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.672, df = 8, p-value = 0.1331
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8622416 0.1776704
#> sample estimates:
#> cor
#> -0.5088825
#>
#>
#> $x_1y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.51762, df = 8, p-value = 0.6187
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7272171 0.5070852
#> sample estimates:
#> cor
#> -0.1800154
#>
#>
#> $x_1y_10
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.027191, df = 8, p-value = 0.979
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6237889 0.6353935
#> sample estimates:
#> cor
#> 0.00961297
#>
#>
#> $x_1y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.025948, df = 8, p-value = 0.9799
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6240572 0.6351315
#> sample estimates:
#> cor
#> 0.009173661
#>
#>
#> $x_1y_12
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.26934, df = 8, p-value = 0.7945
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6836208 0.5687771
#> sample estimates:
#> cor
#> -0.09479795
#>
#>
#> $x_2y_1
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.131, df = 8, p-value = 0.2908
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3371720 0.8112571
#> sample estimates:
#> cor
#> 0.3712727
#>
#>
#> $x_2y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.27357, df = 8, p-value = 0.7913
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5677696 0.6844126
#> sample estimates:
#> cor
#> 0.09627242
#>
#>
#> $x_2y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.75683, df = 8, p-value = 0.4709
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4432842 0.7638038
#> sample estimates:
#> cor
#> 0.2584866
#>
#>
#> $x_2y_9
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.64565, df = 8, p-value = 0.5366
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7474405 0.4734153
#> sample estimates:
#> cor
#> -0.2225464
#>
#>
#> $x_3y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.0356, df = 8, p-value = 0.3307
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3647586 0.8002221
#> sample estimates:
#> cor
#> 0.3438329
#>
#>
#> $x_3y_6
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.36525, df = 8, p-value = 0.7244
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5455462 0.7011583
#> sample estimates:
#> cor
#> 0.1280714
#>
#>
#> $x_3y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.12593, df = 8, p-value = 0.9029
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6020062 0.6557415
#> sample estimates:
#> cor
#> 0.04447966
#>
#>
#> $x_3y_8
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.10064, df = 8, p-value = 0.9223
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6076714 0.6506196
#> sample estimates:
#> cor
#> 0.03556058
#>
#>
#> $x_3y_10
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.226, df = 8, p-value = 0.2551
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8215959 0.3094028
#> sample estimates:
#> cor
#> -0.3976984
#>
#>
#> $x_3y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.1428, df = 8, p-value = 0.2862
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3337125 0.8125854
#> sample estimates:
#> cor
#> 0.3746285
#>
#>
#> $x_4y_3
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.60543, df = 8, p-value = 0.5617
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7412488 0.4841173
#> sample estimates:
#> cor
#> -0.2093091
#>
#>
#> $x_4y_4
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.2468, df = 8, p-value = 0.2477
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3032866 0.8237773
#> sample estimates:
#> cor
#> 0.4033652
#>
#>
#> $x_4y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -2.4507, df = 8, p-value = 0.03989
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.90948113 -0.04289438
#> sample estimates:
#> cor
#> -0.6548353
#>
#>
#> $x_4y_6
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.67516, df = 8, p-value = 0.5186
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7518916 0.4654927
#> sample estimates:
#> cor
#> -0.2321834
#>
#>
#> $x_4y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.26053, df = 8, p-value = 0.801
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5708718 0.6819650
#> sample estimates:
#> cor
#> 0.0917231
#>
#>
#> $x_4y_9
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.35945, df = 8, p-value = 0.7286
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5469720 0.7001237
#> sample estimates:
#> cor
#> 0.1260719
#>
#>
#> $x_4y_10
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.9028, df = 8, p-value = 0.09357
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8789159 0.1101624
#> sample estimates:
#> cor
#> -0.5581799
#>
#>
#> $x_4y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.58023, df = 8, p-value = 0.5777
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4907642 0.7372953
#> sample estimates:
#> cor
#> 0.2009576
#>
#>
#> $x_5y_3
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.0385, df = 8, p-value = 0.3294
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.3639343 0.8005637
#> sample estimates:
#> cor
#> 0.3446707
#>
#>
#> $x_5y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.4494, df = 8, p-value = 0.1853
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8434813 0.2434854
#> sample estimates:
#> cor
#> -0.4560566
#>
#>
#> $x_5y_6
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.4162, df = 8, p-value = 0.1944
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8404338 0.2533082
#> sample estimates:
#> cor
#> -0.4477257
#>
#>
#> $x_5y_9
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.58271, df = 8, p-value = 0.5761
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4901126 0.7376866
#> sample estimates:
#> cor
#> 0.2017808
#>
#>
#> $x_5y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.033809, df = 8, p-value = 0.9739
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6223575 0.6367865
#> sample estimates:
#> cor
#> 0.01195242
#>
#>
#> $x_5y_12
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.20726, df = 8, p-value = 0.841
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.5833898 0.6717950
#> sample estimates:
#> cor
#> 0.07308018
#>
#>
#> $x_6y_2
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.091373, df = 8, p-value = 0.9294
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6097336 0.6487263
#> sample estimates:
#> cor
#> 0.03228832
#>
#>
#> $x_6y_4
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.73967, df = 8, p-value = 0.4806
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4479839 0.7613498
#> sample estimates:
#> cor
#> 0.2530059
#>
#>
#> $x_6y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.2316, df = 8, p-value = 0.2531
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8221858 0.3077581
#> sample estimates:
#> cor
#> -0.3992276
#>
#>
#> $x_6y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.4067, df = 8, p-value = 0.1972
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8395424 0.2561394
#> sample estimates:
#> cor
#> -0.4453016
#>
#>
#> $x_6y_8
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.82321, df = 8, p-value = 0.4342
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4249411 0.7730594
#> sample estimates:
#> cor
#> 0.2794544
#>
#>
#> $x_6y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.4496, df = 8, p-value = 0.1852
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8434979 0.2434311
#> sample estimates:
#> cor
#> -0.4561023
#>
#>
#> $x_7y_1
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.60281, df = 8, p-value = 0.5633
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4848093 0.7408412
#> sample estimates:
#> cor
#> 0.2084444
#>
#>
#> $x_7y_3
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 0.72119, df = 8, p-value = 0.4913
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4530277 0.7586769
#> sample estimates:
#> cor
#> 0.2470734
#>
#>
#> $x_7y_4
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.7753, df = 8, p-value = 0.4605
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7664173 0.4382052
#> sample estimates:
#> cor
#> -0.2643593
#>
#>
#> $x_7y_5
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.64978, df = 8, p-value = 0.534
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.7480676 0.4723110
#> sample estimates:
#> cor
#> -0.223898
#>
#>
#> $x_7y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.1092, df = 8, p-value = 0.2996
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8087934 0.3435069
#> sample estimates:
#> cor
#> -0.365079
#>
#>
#> $x_7y_9
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = 1.4186, df = 8, p-value = 0.1938
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.252606 0.840654
#> sample estimates:
#> cor
#> 0.4483253
#>
#>
#> $x_7y_11
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -1.5589, df = 8, p-value = 0.1576
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.8530650 0.2110694
#> sample estimates:
#> cor
#> -0.482706
#>
#>
#> $x_8y_7
#>
#> Pearson's product-moment correlation
#>
#> data: x and y
#> t = -0.21526, df = 8, p-value = 0.835
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.6733402 0.5815256
#> sample estimates:
#> cor
#> -0.07588588
#>
#>