R/rowsplit.R

Defines functions rowSplit

Documented in rowSplit

#' Split a data.frame or matrix into rows
#' 
#' Utility function for splitting a data.frame into rows.
#' In a whisker template it can be useful to iterate over the rows of a data.frame or matrix.
#' For example rendering a table in HTML.
#' @param x \code{data.frame} or \code{matrix}
#' @param ... other options will be passed onto \code{\link{split}}
#' @export 
#' @example examples/rowSplit.R
rowSplit <- function(x, ...){
  unname(split(x, seq_len(nrow(x)), ...))
}

Try the whisker package in your browser

Any scripts or data that you put into this service are public.

whisker documentation built on Dec. 5, 2022, 5:22 p.m.