pairwise {bullseye} | R Documentation |
A generic function to create a data structure for summarising variable pairs in a dataset
Description
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_)
Arguments
x |
A dataframe or symmetric matrix. |
score |
a character string indicating the value of association |
pair_type |
a character string specifying the type of variable pair, should be either "nn", "fn", "ff", for a numeric-numeric pair, factor-numeric pair, or factor-factor pair, or NA if unknown. |
Details
The pairwise
class has columns x and y for (ordered pairs) of variables, where x < y.
The column score has the name of the summary measure used for the two variables,
and the column value has the associated value.
The group column defaults to "all", meaning summary measures apply to the complete dataset,
otherwise it describes a subset of the data.
The functions pair_*
calculate pairwise tibbles for the summary measure named by *
, eg pair_cor()
, pair_cancor()
.
The functions pairwise_scores()
and pairwise_by()
calculate pairwise tibbles for levels of a grouping variable.
The function pairwise_multi()
calculates a pairwise_tibble for multiple named scores.
The pairwise tibble has at most one row for each combination of x, y, score and group.
This is checked prior to plotting by plot.pairwise
.
Note that the pair_type column is included for information purposes, but it is not currently used by plot.pairwise
.
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 method -
pairwise(data.frame)
: pairwise method -
pairwise(easycorrelation)
: pairwise method
Functions
-
as.pairwise()
: Same aspairwise
Examples
pairwise(cor(iris[,1:4]), score="pearson")
pairwise(iris)
pair_cor(iris)
pair_cancor(iris)
pairwise_scores(iris, by="Species")
pairwise_multi(iris)