I need to add a footnote to tables generated with kable. The output file must be a markdown file. The only option I found is to use add_footnote as footnote function doesn't work with markdown. I just want to add a source to my table, so I don't need to have any symbol. When I use the option notation = 'none' to do not have any function I always have ^^ before my note.
This is my code :
kableISPF <- function(dt, columsContainingPercentIndex=NA, digit=1, percentAccuracy=0.1, caption="Default caption", format="markdown", source="ISPF", note=NA){
x <- copy(dt)
if(!is.na(columsContainingPercentIndex)){
cols=colnames(dt)[columsContainingPercentIndex]
x[ , (cols) := lapply(.SD, FUN=function(x) percent(x, accuracy = percentAccuracy, decimal.mark = ",")), .SDcols = cols]
}
alignChar <- paste0(c("l", unlist(rep('r', length(x)-1))))
if (note!="NA"){note=sprintf("**Note :** %s",note)}else{note=""}
kable(x,
caption = caption,
digits=digit,
format.args = list(big.mark = ' ', decimal.mark = ','),
align=alignChar,
format = format, booktabs=T)%>%
kable_paper(full_width = T,
lightable_options = "hover",
html_font="\"Helvetica Neue\",Helvetica,Arial,sans-serif")%>%
add_footnote(label=sprintf("**Source : **%s",source),notation='none')
}
And I call it with (as exemple) :
kableISPF(POP.G2[Commune][[1]],c(2,3,4), 1, 0.1,caption = "POP G2 - Population par grandes tranches d'âges",source = "ISPF - Recensement de la population",note = "NA")
Why do I have this behavior ? How to avoid ^^ characters ?
Thanks a lot for your help.