apply_symm: Apply function to each pair of data frames from a list.

View source: R/tools.R

apply_symmR Documentation

Apply function to each pair of data frames from a list.

Description

Apply the given function to every pair in the given datalist. Function either symmetrical (i.e. fun(x,y) == fun(y,x)) or assymmetrical (i.e. fun(x,y) != fun(y,x)).

Usage

apply_symm(.datalist, .fun, ..., .diag = NA, .verbose = TRUE)

apply_asymm(.datalist, .fun, ..., .diag = NA, .verbose = TRUE)

Arguments

.datalist

List with some data.frames.

.fun

Function to apply, which return basic class value.

...

Arguments passsed to .fun.

.diag

Either NA for NA or something else != NULL for .fun(x,x).

.verbose

if TRUE then output a progress bar.

Value

Matrix with values M[i,j] = fun(datalist[i], datalist[j])

Examples

data(immdata)
apply_symm(immdata$data, function(x, y) {
  nrow(x) + nrow(y)
})

immunomind/immunarch documentation built on March 20, 2024, 12:01 p.m.