#271
diff --git a/R/footnote.R b/R/footnote.R
index 5d1e363..61d36f4 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -31,7 +31,8 @@
#' @param symbol_title Section header for symbol footnotes. Default is "".
#' @param title_format Choose from "italic"(default), "bold" and "underline".
#' Multiple options are possible.
-#'
+#' @param symbol_manual User can manually supply a vector of either html or
+#' latex symbols. For example, `symbol_manual = c('*', '\\\\dag', '\\\\ddag')`.`
#'
#' @examples dt <- mtcars[1:5, 1:5]
#' footnote(knitr::kable(dt, "html"), alphabet = c("Note a", "Note b"))
@@ -51,7 +52,8 @@
number_title = "",
alphabet_title = "",
symbol_title = "",
- title_format = "italic"
+ title_format = "italic",
+ symbol_manual = NULL
) {
kable_format <- attr(kable_input, "format")
if (!kable_format %in% c("html", "latex")) {
@@ -98,7 +100,7 @@
footnote_titles <- lapply(footnote_titles, footnote_title_format,
kable_format, title_format)
footnote_table <- footnote_table_maker(
- kable_format, footnote_titles, footnote_contents
+ kable_format, footnote_titles, footnote_contents, symbol_manual
)
if (kable_format == "html") {
return(footnote_html(kable_input, footnote_table, footnote_as_chunk))
@@ -139,15 +141,21 @@
}
}
-footnote_table_maker <- function(format, footnote_titles, footnote_contents) {
- number_index <- read.csv(system.file("symbol_index.csv",
- package = "kableExtra"))
- if (format == "latex") {
- symbol_index <- number_index$symbol.latex
+footnote_table_maker <- function(format, footnote_titles, footnote_contents,
+ symbol_manual) {
+ if (is.null(symbol_manual)) {
+ number_index <- read.csv(system.file("symbol_index.csv",
+ package = "kableExtra"))
+ if (format == "latex") {
+ symbol_index <- number_index$symbol.latex
+ } else {
+ symbol_index <- number_index$symbol.html
+ }
} else {
- symbol_index <- number_index$symbol.html
+ symbol_index <- symbol_manual
}
+
if (!is.null(footnote_contents$general)) {
footnote_contents$general <- data.frame(
index = "",
diff --git a/inst/NEWS.md b/inst/NEWS.md
index a389439..3c12b24 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -2,6 +2,10 @@
--------------------------------------------------------------------------------
# Major Changes
+# Minor Features
+* Added symbol_manual to footnote so that users can manually customize the
+sequence of symbols in footnote.
+
# Bug Fixes
* Fixed an issue that prevents linebreak works with factor
diff --git a/man/footnote.Rd b/man/footnote.Rd
index 0f9e9aa..34b3f61 100644
--- a/man/footnote.Rd
+++ b/man/footnote.Rd
@@ -9,7 +9,7 @@
"symbol"), footnote_as_chunk = FALSE, escape = TRUE,
threeparttable = FALSE, general_title = "Note: ",
number_title = "", alphabet_title = "", symbol_title = "",
- title_format = "italic")
+ title_format = "italic", symbol_manual = NULL)
}
\arguments{
\item{kable_input}{HTML or LaTeX table generated by \code{knitr::kable}}
@@ -51,6 +51,9 @@
\item{title_format}{Choose from "italic"(default), "bold" and "underline".
Multiple options are possible.}
+
+\item{symbol_manual}{User can manually supply a vector of either html or
+latex symbols. For example, \code{symbol_manual = c('*', '\\\\dag', '\\\\ddag')}.`}
}
\description{
\code{footnote} provides a more flexible way to add footnote. You