Dear list members,

I recall seeing a convenience function for applying multiple functions to 
one object (i.e., almost the opposite of 'mapply’) somewhere.
Example: If the function was named ’fun’ the output of

  fun(3.14, mode, typeof, class)

would be identical to the output of

  c(mode(3.14), typeof(3.14), class(3.14))

Is my memory failing me, or does such a function already exists in a 
package? Of course, it’s not difficult to define a summary function and 
apply this to the object, but writing, for example,

fun(x, mean, median, sd, mad)

to quickly show the relevant information is much more *convient*.


It would be even nicer with a function that could also handle vectors and 
lists of values, and output the result as data frames or matrices. Example: 

x = c("foo", "bar", "foobar")
fun(x, nchar, function(st) substr(st, 1 ,2) )

y = list(3, 3L, 3.14, factor(3))
fun(x, mode, typeof, class)

-- 
Karl Ove Hufthammer

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to