I would like to form the following LaTeX-table with xtable-package in R.
Table 1: Wanted LaTeX table
However, I do not understand how to add multiple extra rows to xtable-function to get above table.
For example using simple code like this
financial <- c(1.23, 1.19)
macro <- c(1.50, 1.40)
X <- rbind(financial, macro)
colnames(X) <- c("A","B")
X
A B
financial 1.23 1.19
macro 1.50 1.40
print(xtable(X), type="latex")
Now, how do you add the the extra rows, alignments, hlines(e.g., Country, United States, Method etc.) to xtable-function to the achieve above table?
I already looked at https://cran.r-project.org/web/packages/xtable/vignettes/xtableGallery.pdf but I did not find any clear anwer to my question.
Any help would be appreciated!

Here's my approach (with inspiration from)
add.to.rowcan be used to include custom latex code into xtable.I did could not figure out how to place your column names
& A & Bafter the custom header. My solution for this was to useinclude.colnames = FALSEand manually inserted column headers inadd.to.row. (perhaps someone else has a more elegant solution?)Result: