Drop version due to CRAN resubmission; Add examples as requested
diff --git a/R/add_footnote.R b/R/add_footnote.R
index a6524a5..024df3b 100644
--- a/R/add_footnote.R
+++ b/R/add_footnote.R
@@ -13,7 +13,11 @@
#' @param notation You can select the format of your footnote notation from
#' `number`, `alphabet` and `symbol`.
#' @param threeparttable Boolean value indicating if a
-#' \href{https://www.ctan.org/pkg/threeparttable}{threeparttable} scheme should be used.
+#' \href{https://www.ctan.org/pkg/threeparttable}{threeparttable} scheme should
+#' be used.
+#'
+#' @examples x <- knitr::kable(head(mtcars), "html")
+#' add_footnote(x, c("footnote 1", "footnote 2"), notation = "symbol")
#'
#' @export
add_footnote <- function(input, label = NULL,
diff --git a/R/add_header_above.R b/R/add_header_above.R
index 92e2040..0f39d43 100644
--- a/R/add_header_above.R
+++ b/R/add_header_above.R
@@ -12,6 +12,11 @@
#' convenience, when `colspan` equals to 1, users can drop the ` = 1` part.
#' As a result, `c(" ", "title" = 2)` is the same as `c(" " = 1, "title" = 2)`.
#'
+#' @examples x <- knitr::kable(head(mtcars), "html")
+#' # Add a row of header with 3 columns on the top of the table. The column
+#' # span for the 2nd and 3rd one are 5 & 6.
+#' add_header_above(x, c(" ", "Group 1" = 5, "Group 2" = 6))
+#'
#' @export
add_header_above <- function(kable_input, header = NULL) {
kable_format <- attr(kable_input, "format")
diff --git a/R/add_indent.R b/R/add_indent.R
index 6e71a44..33ad6f7 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -4,6 +4,10 @@
#' @param positions A vector of numeric row numbers for the rows that need to
#' be indented.
#'
+#' @examples x <- knitr::kable(head(mtcars), "html")
+#' # Add indentations to the 2nd & 4th row
+#' add_indent(x, c(2, 4))
+#'
#' @export
add_indent <- function(kable_input, positions) {
if (!is.numeric(positions)) {
diff --git a/R/column_spec.R b/R/column_spec.R
index 9748713..0c383d5 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -12,9 +12,13 @@
#' need to be bolded.
#' @param italic A T/F value to control whether the text of the selected column
#' need to be emphasized.
+#'
+#' @examples x <- knitr::kable(head(mtcars), "html")
+#' column_spec(x, 1, width = "20em", bold = TRUE, italic = TRUE)
+#'
#' @export
column_spec <- function(kable_input, column,
- width = NULL, bold = F, italic = F) {
+ width = NULL, bold = FALSE, italic = FALSE) {
if (!is.numeric(column)) {
stop("column must be a numeric value")
}
diff --git a/R/group_rows.R b/R/group_rows.R
index c768386..2df22ca 100644
--- a/R/group_rows.R
+++ b/R/group_rows.R
@@ -16,6 +16,10 @@
#' between the previous row and the group labeling row. Only useful for LaTeX
#' documents.
#'
+#' @examples x <- knitr::kable(head(mtcars), "html")
+#' # Put Row 2 to Row 5 into a Group and label it as "Group A"
+#' group_rows(x, "Group A", 2, 5)
+#'
#' @export
group_rows <- function(kable_input, group_label, start_row, end_row,
label_row_css = "border-bottom: 1px solid;",
diff --git a/R/kable_styling.R b/R/kable_styling.R
index c04029a..7e6f92a 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -32,6 +32,12 @@
#' imported.
#' @param font_size A numeric input for table font size
#'
+#' @examples x_html <- knitr::kable(head(mtcars), "html")
+#' kable_styling(x_html, "striped", position = "left", font_size = 7)
+#'
+#' x_latex <- knitr::kable(head(mtcars), "latex")
+#' kable_styling(x_latex, latex_options = "striped", position = "float_left")
+#'
#' @export
kable_styling <- function(kable_input,
bootstrap_options = "basic",
diff --git a/R/landscape.R b/R/landscape.R
index 5727fe6..75d9255 100644
--- a/R/landscape.R
+++ b/R/landscape.R
@@ -7,6 +7,8 @@
#' @param margin Customizable page margin for special needs. Values can be
#' "1cm", "1in" or similar.
#'
+#' @examples landscape(knitr::kable(head(mtcars), "latex"))
+#'
#' @export
landscape <- function(kable_input, margin = NULL) {
kable_format <- attr(kable_input, "format")
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index 088ee90..2e415f7 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -3,6 +3,8 @@
#' @description Mirror mirror tell me, how does this kable look like?
#'
#' @param kable_input The output of kable
+#'
+#' @examples magic_mirror(knitr::kable(head(mtcars), "html"))
#' @export
magic_mirror <- function(kable_input){
diff --git a/R/util.R b/R/util.R
index 66ee3be..c16b79d 100644
--- a/R/util.R
+++ b/R/util.R
@@ -26,6 +26,8 @@
#'
#' @param name The LaTeX package name
#' @param options The LaTeX options for the package
+#'
+#' @examples usepackage_latex("xcolor")
#' @export
usepackage_latex <- function(name, options = NULL) {
invisible(knit_meta_add(list(latex_dependency(name, options))))