kable(head(iris), format = "latex")
kable(head(iris), format = "html")
# use the booktabs package
kable(mtcars, format = "latex", booktabs = TRUE)
# use the longtable package
kable(matrix(1000, ncol = 5), format = "latex", digits = 2, longtable = TRUE)
# add some table attributes
kable(head(iris), format = "html", table.attr = "id="mytable"")
# reST output
kable(head(mtcars), format = "rst")
# no row names
kable(head(mtcars), format = "rst", row.names = FALSE)
# R Markdown/Github Markdown tables
kable(head(mtcars[, 1:5]), format = "markdown")
# Pandoc tables
kable(head(mtcars), format = "pandoc")
# save the value
x = kable(mtcars, format = "html", output = FALSE)
cat(x, sep = "\n")
# can also set options(knitr.table.format = 'html') so that the output is HTML
Run the code above in your browser using DataLab