Merge pull request #371 from JiaxiangBU/master

Add the examples to kable_as_image.R 
diff --git a/R/as_image.R b/R/as_image.R
index 8e5e0fd..4b797bc 100644
--- a/R/as_image.R
+++ b/R/as_image.R
@@ -14,7 +14,15 @@
 #'
 #' @param ... Additional arguments passed to save_kable.
 #'
+#' @examples
+#' \dontrun{
+#' library(kableExtra)
 #'
+#' kable(mtcars, "latex", booktabs = T) %>%
+#' kable_styling(latex_options = c("striped", "scale_down")) %>%
+#' row_spec(1, color = "red") %>%
+#' as_image()
+#' }
 #' @export
 as_image <- function(x, width = NULL, height = NULL, file = NULL, ...) {
   if (is.null(width) + is.null(height) == 0) {
diff --git a/R/save_kable.R b/R/save_kable.R
index 35e805a..3c3a5fa 100644
--- a/R/save_kable.R
+++ b/R/save_kable.R
@@ -18,7 +18,15 @@
 #' table, such as `\\\\usepackage[magyar]{babel}`.
 #' @param keep_tex A T/F option to control if the latex file that is initially created
 #' should be kept. Default is `FALSE`.
+#' @examples
+#' \dontrun{
+#' library(kableExtra)
 #'
+#' kable(mtcars[1:5, ], "html") %>%
+#'   kable_styling("striped") %>%
+#'   row_spec(1, color = "red") %>%
+#'   save_kable("inst/test.pdf")
+#' }
 #' @export
 save_kable <- function(x, file,
                        bs_theme = "simplex", self_contained = TRUE,
diff --git a/man/kable_as_image.Rd b/man/kable_as_image.Rd
index a10b331..e28247a 100644
--- a/man/kable_as_image.Rd
+++ b/man/kable_as_image.Rd
@@ -37,3 +37,18 @@
 \description{
 deprecated
 }
+\examples{
+\dontrun{
+library(kableExtra)
+
+kable(mtcars[1:5, ], "html") \%>\%
+  kable_styling("striped") \%>\%
+  row_spec(1, color = "red") \%>\%
+  save_kable("inst/test.pdf")
+
+kable(mtcars, "latex", booktabs = T) \%>\%
+kable_styling(latex_options = c("striped", "scale_down")) \%>\%
+row_spec(1, color = "red") \%>\%
+as_image()
+}
+}