[R] How do you apply a function to each variable in a data frame?
zerfetzen
zerfetzen at yahoo.com
Mon Nov 3 16:03:36 CET 2008
I want to apply a more complicated function than what I use in my example,
but the idea is the same:
Suppose you have a data frame named x and you want to a function applied to
each variable, we'll just use the quantile function for this example. I'm
trying all sorts of apply functions, but not having luck. My best guess
would be:
sapply(x, FUN=quantile)
--
View this message in context: http://www.nabble.com/How-do-you-apply-a-function-to-each-variable-in-a-data-frame--tp20304332p20304332.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list