dotsapply: List apply for '...' arguments

Description Usage Arguments Details Value Author(s)

View source: R/utils.R


A kludge to get around a certain problem in using lapply with '...' ellipsis function arguments.


dotsapply( fun, ... )



A function that takes one argument


Arguments to which the function should be applied


"dotsapply(fun,...)" gives the same result as lapply( list(...), fun). However, the construction with "list", when used for variables enumerated explicitely, will result in their duplication.

Assume, for example, that you have three very large vectors a, b, and c, whose lengths you wish to know. If your write "lapply( list(a,b,c), length )", R will duplicate all three vectors in memory when constructing the list, which results in unnecessary use of memory. The alternative "dotsapply( length, a, b, c )" avoids this. Of course, you could also write "list( length(a), length(b), length(c) )", which neither causes duplication.

This last possibility is, however, not an option, if, instead of "a,b,c", you have ellipsed function arguments, i.e. literally "...". In this special case, dotsapply comes in handy, and as this case arose in hilbertDisplay, I implemented dotsapply as a kludge and export it from the package just in case somebody ahs use for it.


A list of function values


Simon Anders, EMBL-EBI,

HilbertVisGUI documentation built on Nov. 8, 2020, 5:48 p.m.