R/my.lapply.R

#'
#'@title my version of lapply
#'
#'@description A convenience implementation of lapply
#'
#'@param X - data to apply function to (coerced to list if necessary)
#'@param FUN - function to apply to X
#'@param ... - other inputs to FUN
#'
#'@return result of lapply'ing function to X
#'
#'@details None.
#'
#'@export
#'
my.lapply<-function (X, FUN, ...) {
    FUN <- match.fun(FUN)
    if (!is.list(X)) 
        X <- as.list(X)
    rval <- lapply(X, FUN)
    return(rval)
}
wStockhausen/wtsUtilities documentation built on Feb. 3, 2025, 6:29 a.m.