Learn R Programming

MKmisc (version 1.9)

pairwise.fun: Compute pairwise values for a given function

Description

The function computes pairwise values for a given function.

Usage

pairwise.fun(x, g, fun, ...)

Value

Vector with pairwise function values.

Arguments

x

numeric vector.

g

grouping vector or factor

fun

some function where the first two arguments have to be numeric vectors for which the function computes some quantity; see example section below.

...

additional arguments to fun.

Author

Matthias Kohl Matthias.Kohl@stamats.de

Details

The function computes pairwise values for a given function.

The implementation is in certain aspects analogously to pairwise.t.test.

See Also

pairwise.t.test, pairwise.fc, pairwise.logfc, pairwise.auc

Examples

Run this code
set.seed(13)
x <- rnorm(100)
g <- factor(sample(1:4, 100, replace = TRUE))
levels(g) <- c("a", "b", "c", "d")
pairwise.fun(x, g, fun = function(x, y) t.test(x,y)$p.value)
## in contrast to
pairwise.t.test(x, g, p.adjust.method = "none", pool.sd = FALSE)

Run the code above in your browser using DataLab