#' colApply apply the function to the rows of a dataframe row-wise #' #' @param f - a function which operates on a vector #' @param ... a list of vectors colApply = function(f, ...) browser() if (!all(sapply(list(...), length)==length(list(...)[[1]]))) stop("arguments must all have same length") m = matrix(c(...),ncol=length(list(...))) out = apply(m, 1, f, na.rm=TRUE) return(out) capture a data frame for an error message
1 |
x |
a dataframe |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.