Legacy or Unrecommended Features

This document includes documentations for legacy/unrecommended features in this package.

Unless there are significant differences between HTML/LaTeX, I will only keep one copy of documentation in HTML here since most of the functions in this packages share a very similar interface between their HTML and LaTeX ends.

library(kableExtra)
dt <- mtcars[1:5, 1:6]

Unrecommended Features

add_footnote

As the first function written in this package, the design of the add_footnote function is not flexible enough to introduce new features to this function. So I redesigned the footnote part and created the footnote() function. add_footnote will still be there for a while and be maintained because of its unique feature to add page footnote to longtables.

Here are the old documentation for add_footnote.

Notation systems

You can also use add_footnote() function from this package. You will need to supply a character vector with each element as one footnote. You may select from number, alphabet and symbol for different types of notations. Example are listed below.

Alphabet

kable(dt, "html") %>%
  kable_styling("striped") %>%
  add_footnote(c("Footnote 1", "Have a good day."), notation = "alphabet")
mpg cyl disp hp drat wt
Mazda RX4 21.0 6 160 110 3.90 2.620
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875
Datsun 710 22.8 4 108 93 3.85 2.320
Hornet 4 Drive 21.4 6 258 110 3.08 3.215
Hornet Sportabout 18.7 8 360 175 3.15 3.440
a Footnote 1
b Have a good day.

Number

kable(dt, "html") %>%
  kable_styling("striped") %>%
  add_footnote(c("Footnote 1", "Have a good day."), notation = "number")
mpg cyl disp hp drat wt
Mazda RX4 21.0 6 160 110 3.90 2.620
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875
Datsun 710 22.8 4 108 93 3.85 2.320
Hornet 4 Drive 21.4 6 258 110 3.08 3.215
Hornet Sportabout 18.7 8 360 175 3.15 3.440
1 Footnote 1
2 Have a good day.

Symbol

kable(dt, "html") %>%
  kable_styling("striped") %>%
  add_footnote(c("Footnote 1", "Footnote 2", "Footnote 3"), notation = "symbol")
mpg cyl disp hp drat wt
Mazda RX4 21.0 6 160 110 3.90 2.620
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875
Datsun 710 22.8 4 108 93 3.85 2.320
Hornet 4 Drive 21.4 6 258 110 3.08 3.215
Hornet Sportabout 18.7 8 360 175 3.15 3.440
* Footnote 1
Footnote 2
Footnote 3

In-table markers

By design, add_footnote() will transform any [note] to in-table footnote markers.

kable(dt, "html", caption = "Demo Table[note]") %>%
  kable_styling("striped") %>%
  add_header_above(c(" ", "Group 1[note]" = 3, "Group 2[note]" = 3)) %>%
  add_footnote(c("This table is from mtcars", 
                 "Group 1 contains mpg, cyl and disp", 
                 "Group 2 contains hp, drat and wt"), 
               notation = "symbol")
Demo Table*
Group 1
Group 2
mpg cyl disp hp drat wt
Mazda RX4 21.0 6 160 110 3.90 2.620
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875
Datsun 710 22.8 4 108 93 3.85 2.320
Hornet 4 Drive 21.4 6 258 110 3.08 3.215
Hornet Sportabout 18.7 8 360 175 3.15 3.440
* This table is from mtcars
Group 1 contains mpg, cyl and disp
Group 2 contains hp, drat and wt