I was wondering if anyone knows how to add a footnote beneath an Xtable, as well as seperating each column with a vertical line to make this table look a bit neater.
I would like my footnote to say "these are ADF test results"
I've reproduced my code and dataframe below
{r table_3, echo = FALSE, warning = FALSE, message = FALSE, results = 'asis'}
library(tidyverse)
library(tidyselect)
library(xtable)
library(readxl)
library(knitr)
# Create Dataframe
variables <- c("Argentina Bond Flows", "Argentina Equity Flows", "Chile Bond Flows", "Chile Equity Flows", "Mexico Bond Flows",
"Mexico Equity Flows", "Indonesia Bond Flows", "Indonesia Equity Flows", "Korea Bond Flows", "Korea Equity Flows",
"Philippines Bond Flows", "Philippines Equity Flows", "Thailand Bond Flows", "Thailand Equity Flows",
"South Africa Bond Flows", "South Africa Equity Flows","United States S&P 500", "United States M1")
adf <- c("-4.3557","-6.4865","-3.4893","-3.3485","-2.6294","-5.511","-2.9238","-6.0305","-9.7081","-2.0444","-4.7619","-5.6108","-4.6314","-4.6218","-4.3337","-3.7213","2.6471"," 4.0174")
pp <- c("-6.9685","-9.3864","-6.7449","-5.6533","-6.0265","-9.4065","-6.531","-7.5043","-21.0764","-3.5716","-8.3505","-6.5574 ","-10.3266","-7.445","-8.9639","-6.3464","-11.1298","4.0512")
variables2 <- c("Argentina M1", "Argentina Equity Index", "Chile M1", "Chile Equity Index", "Mexico M1",
"Mexico Equity Index", "Indonesia M1", "Indonesia Equity Index", "Korea M1", "Korea Equity Index",
"Philippines M1", "Philippines Equity Index", "Thailand M1", "Thailand Equity Index",
"South Africa M1", "South Africa Equity Index","", "")
adf2 <- c("-6.9593","6.1785","3.6245","-2.2697","3.2417","2.4172","2.4237","2.0484","3.8211","-6.938","-6.9593","-7.7315","-6.9593","6.1785","-8.0415 ","2.5385","","")
pp2 <- c("-13.7725","4.8728","-11.0177","-9.3776","-14.3688 ","-2.2334","-13.1095","-8.8171","-11.1806","-9.8397","-13.7725","-9.4015","-2.6801","-11.8756","-10.681"," -9.6241","","")
unit_table <- data.frame(variables, adf, pp,variables2, adf2,pp2)
colnames(unit_table) <- c("Country Variable", "ADF", "PP","Country Variable", "ADF", "PP")
# Create a table using XTable
table <- xtable(unit_table, caption = "Unit Root Test Results \\label{Table3}",
# tabular.environment = "longtable",
floating = TRUE,
table.placement = 'H',
include.rownames = FALSE,
# scalebox = 0.3,
comment = FALSE,
caption.placement = 'top'
)
bold <- function(x) {paste('{\\textbf{',x,'}}', sep ='')}
print(table, include.rownames = FALSE, sanitize.colnames.function=bold, comment = FALSE)
Also, how do I go about boldifying certain words in the table. For example if I wanted to boldify "Korea Bond Flows", how would I go about doing that?
TIA!