lapplyTest: Apply a function to a list.

Description Usage Arguments Details Value See Also Examples

Description

Takes a list and applies to each of its elements a function, returning a list of outputs. Primary intended for tests of independence on a list of contingency tables.

Usage

1

Arguments

x

[list] The list to which to apply fun.

fun

[function] The function which to apply to data. Must return an object containing an element named p.value. Defaults to chisq.test.

...

Additional arguments passed to fun.

Details

When applying a function to a list, any iteration that results in an error, breaks the whole loop. This is not always the most convenient behaviour, in particular when the function is a statistical test and the error is to do with sparse data in one of the tables in the list. lapplyTest is a wrapper around base::lapply which only differs from the original in its treatment of errors. It saves the message associated with the error or warning, but then continues to the next iteration rather than quitting the loop altogether.

Value

[list.lapplyTest] A list of outputs of fun.

See Also

summary.list.lapplyTest, allCooccs

Examples

1
2
3
dataset <- loadSampleDataset ("data-abc")
lapplyTest (allCooccs(dataset))
lapplyTest (allCooccs(dataset), fisher.test, simulate.p.value=TRUE)

soundcorrs documentation built on Nov. 16, 2020, 5:09 p.m.