A generic function to create a data structure for every variable pair in a dataset
Source:R/pairwise.R
pairwise.Rd
Creates a data structure for every variable pair in a dataset.
Usage
pairwise(x, score = NA_character_, pair_type = NA_character_)
# S3 method for class 'matrix'
pairwise(x, score = NA_character_, pair_type = NA_character_)
# S3 method for class 'data.frame'
pairwise(x, score = NA_character_, pair_type = NA_character_)
# S3 method for class 'easycorrelation'
pairwise(x, score = NA_character_, pair_type = NA_character_)
as.pairwise(x, score = NA_character_, pair_type = NA_character_)
Value
A tbl_df of class pairwise
for pairs of variables with a column value
for the score value,
score
for a type of association value and pair_type
for the type of variable pair.
Methods (by class)
pairwise(matrix)
: pairwise methodpairwise(data.frame)
: pairwise methodpairwise(easycorrelation)
: pairwise method
Examples
pairwise(cor(iris[,1:4]), score="pearson")
#> # A tibble: 6 × 6
#> x y score group value pair_type
#> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 Petal.Length Sepal.Length pearson all 0.872 NA
#> 2 Petal.Width Sepal.Length pearson all 0.818 NA
#> 3 Sepal.Length Sepal.Width pearson all -0.118 NA
#> 4 Petal.Length Sepal.Width pearson all -0.428 NA
#> 5 Petal.Width Sepal.Width pearson all -0.366 NA
#> 6 Petal.Length Petal.Width pearson all 0.963 NA
pairwise(iris)
#> # A tibble: 10 × 6
#> x y score group value pair_type
#> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 Petal.Length Sepal.Length NA all NA nn
#> 2 Petal.Width Sepal.Length NA all NA nn
#> 3 Sepal.Length Sepal.Width NA all NA nn
#> 4 Petal.Length Sepal.Width NA all NA nn
#> 5 Petal.Width Sepal.Width NA all NA nn
#> 6 Petal.Length Petal.Width NA all NA nn
#> 7 Sepal.Length Species NA all NA fn
#> 8 Sepal.Width Species NA all NA fn
#> 9 Petal.Length Species NA all NA fn
#> 10 Petal.Width Species NA all NA fn