lapply {BiocGenerics}R Documentation

Apply a function over a list-like or vector-like R object

Description

lapply returns a list of the same length as X, each element of which is the result of applying FUN to the corresponding element of X.

sapply is a user-friendly version and wrapper of lapply by default returning a vector, matrix or, if simplify="array", an array if appropriate, by applying simplify2array(). sapply(x, f, simplify=FALSE, USE.NAMES=FALSE) is the same as lapply(x, f).

NOTE: This man page is for the lapply and sapply S4 generic functions defined in the BiocGenerics package. See ?base::lapply for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically list-like or vector-like) not supported by the default methods.

Usage

lapply(X, FUN, ...)
sapply(X, FUN, ..., simplify=TRUE, USE.NAMES=TRUE)

Arguments

X

A list-like or vector-like R object.

FUN, ..., simplify, USE.NAMES

See ?base::lapply for a description of these arguments.

Value

See ?base::lapply for the value returned by the default methods.

Specific methods defined in other Bioconductor packages should behave as consistently as possible with the default methods. In particular, lapply and sapply(simplify=FALSE) should always return a list.

See Also

base::lapply for the default lapply and sapply methods.

showMethods for displaying a summary of the methods defined for a given generic function.

selectMethod for getting the definition of a specific method.

lapply,List-method in the IRanges package for the lapply method defined for List objects.

BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

lapply  # note the dispatch on the 'X' arg only
showMethods("lapply")
selectMethod("lapply", "ANY")  # the default method

sapply  # note the dispatch on the 'X' arg only
showMethods("sapply")
selectMethod("sapply", "ANY")  # the default method

[Package BiocGenerics version 0.2.0 Index]