R/htmlTable.R

Defines functions htmlTable

Documented in htmlTable

## This code is part of the megaptera package
## © C. Heibl 2016 (last update 2016-11-03)

#' @export

htmlTable <- function(tab) {
  
  ## table header
  h <- paste("<th>", colnames(tab), "</th>", sep = "")
  h <- paste(h, collapse = "")
  h <- paste("<tr>", h, "</tr>", sep = "")
  
  ## table body
  tab <- apply(tab, c(1, 2), function(z) 
    paste("<td>", z, "</td>", sep = ""))
  tab <- apply(tab, 1, paste, collapse = "")
  tab <- paste("<tr>", tab, "</tr>", sep = "")
  tab <- c("<table border = 1>", h, tab, "</table>")
  tab
}
heibl/megaptera documentation built on Jan. 17, 2021, 3:34 a.m.