| Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 1 | #' @import htmlwidgets |
| 2 | #' @export | ||||
| 3 | kableWidget <- function(kable_input, width = NULL, height = NULL) { | ||||
| 4 | kable_format <- attr(kable_input, "format") | ||||
| 5 | if (kable_format != "html") { | ||||
| 6 | stop("kable_as_widget only works for HTML tables.") | ||||
| 7 | } | ||||
| 8 | x <- as.character(kable_input) | ||||
| 9 | htmlwidgets::createWidget("kable_as_widget", x, | ||||
| 10 | width = width, height = height) | ||||
| 11 | } | ||||