stats::cor.test() in stats accepts formulas of the
shape ~ y + x. The mosaic package allows the use
of y ~ x as an alternative formula shape.
# S3 method for formula
cor_test(formula, ...)
cor.test(x, ...)
cor_test(x, ...)
# S3 method for default
cor_test(x, y, ...)a formula
other arguments passed to stats::cor.test().
numeric vectors of data values. x and y must have the same length.
stats::cor.test() in the stats package.
# This is an example from example(stats::cor.test) done in old and new style
require(graphics)
cor.test(~ CONT + INTG, data = USJudgeRatings)
#>
#> Pearson's product-moment correlation
#>
#> data: CONT and INTG
#> t = -0.8605, df = 41, p-value = 0.3945
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4168591 0.1741182
#> sample estimates:
#> cor
#> -0.1331909
#>
cor.test(CONT ~ INTG, data = USJudgeRatings)
#>
#> Pearson's product-moment correlation
#>
#> data: CONT and INTG
#> t = -0.8605, df = 41, p-value = 0.3945
#> alternative hypothesis: true correlation is not equal to 0
#> 95 percent confidence interval:
#> -0.4168591 0.1741182
#> sample estimates:
#> cor
#> -0.1331909
#>