7

I am attempting to create a table which has citations built into the table. Here is a visual of what I am trying to achieve.

desired output

As far as I know you can only add footnotes in rowvars or colvars in kableExtra (love that package).

# Create a dataframe called df
Component <- c('N2','P3')
Latency <- c('150 to 200ms', '625 to 800ms')
Location <- c('FCz, Fz, Cz', 'Pz, Oz')
df <- data.frame(Component, Latency, Location)

Below is my attempt after reading through kableExtra's Git page

# Trying some code taken from the kableExtra guide
row.names(df) <- df$Component
df[1] <- NULL
dt_footnote <- df
names(dt_footnote)[1] <- paste0(names(dt_footnote)[2],
                                footnote_marker_symbol(1))

row.names(dt_footnote)[2] <- paste0(row.names(dt_footnote)[2], 
                                footnote_marker_alphabet(1))
kable(dt_footnote, align = "c", 
      # Remember this escape = F
      escape = F, "latex", longtable = T, booktabs = T, caption = "My Table Name") %>%
  kable_styling(full_width = F) %>%
  footnote(alphabet = "Jones, 2013",
           symbol = "Footnote Symbol 1; ",
           footnote_as_chunk = T)

Output

But this code only works on the headers. The ultimate goal would be if I could use a BibTex reference such as @JonesFunctionalMixedEffectModels2013 such that the final part of the code would look like

footnote(alphabet = @davidsonFunctionalMixedEffectModels2009,
           symbol = "Footnote Symbol 1; ", footnote_as_chunk = T)

Anyone have any ideas?

Thanks

Patrick
  • 915
  • 2
  • 9
  • 26
  • I was not able to find a solution. I would suggest trying to contact the developer of kableExtra on his [Git page](https://github.com/haozhu233/kableExtra/issues) if you are in need of a solution. I eventually just made the modification in Word after compiling the document. I am a big fan of the package because you are able to reduce the amount of code required to get a nice end result. – Patrick Dec 17 '18 at 04:12

1 Answers1

0

What I did at the end was to generate a temporary table with pander, then copy the references' number manually to my kable

pander(
  df,
  caption = "Temporal",
  style = "simple",
  justify = "left")
Julio
  • 283
  • 2
  • 13