R/juicyTable.R

#' @import htmltools
NULL

#' Juicystable
#'
#' Juicystable
#' @examples
#' juicyTable( head(iris) )
#' @export
juicyTable <- function(data){
  data <- oddsandsods::prettyNames(data)
  thead_elem <-
    lapply( colnames(data) , function(colname)
      withTags( th( colname ) )
    )

  tbody_elem <-
    apply(data, 1, function(row)
      withTags(
        tr(
          lapply( row , td )
        )
      )
    )

  as.character(
    withTags(
      table(class="simple",
            thead( tr( thead_elem) ),
            tbody(tbody_elem)
      )
    )
  )
}
elo2zero/juicystat.vis documentation built on May 31, 2019, 8:06 a.m.