I would like to combine stargazer
(from the same named R package) with \textsubscript
to end up with a LaTeX table that looks roughly like this.
My first approach
dat <- data.frame(count = 4000, value = .4)
rownames(dat) <- "NDVI\textsubscript{3g}"
library(stargazer)
stargazer(dat, summary = FALSE)
created this LaTeX tabular code (shortened version)
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& count & value \\
\hline \\[-1.8ex]
NDVI extsubscript\{3g\} & $4,000$ & $0.400$ \\
\hline \\[-1.8ex]
i.e., \t
was interpreted as TAB. I found here that it is possible to avoid such behavior by adding a second backslash like
dat2 <- data.frame(count = 4000, value = .4)
rownames(dat2) <- "NDVI\\textsubscript{3g}"
stargazer(dat2, summary = FALSE)
but now, the resulting code looks even more weird
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& count & value \\
\hline \\[-1.8ex]
NDVI\textbackslash textsubscript\{3g\} & $4,000$ & $0.400$ \\
Does anybody know how to solve this issue from the R side, i.e., without manually editing the LaTeX code after it has been created via stargazer
?