splat {plyr} | R Documentation |
Wraps a function in do.call
splat(flat)
flat |
function to splat |
This is useful when you want to pass a function a row of data frame or array, and don't want to manually pull it apart in your function.
a function
Hadley Wickham <h.wickham@gmail.com>
hp_per_cyl <- function(hp, cyl, ...) hp / cyl splat(hp_per_cyl)(mtcars[1,]) splat(hp_per_cyl)(mtcars) f <- function(mpg, wt, ...) data.frame(mw = mpg / wt) ddply(mtcars, .(cyl), splat(f))