I would like to include the regression output from etable(feols(fml = formula, data = data, cluster = ~cluster))
as latex regression table into an rmarkdown creating an html output.
My regression function at the moment is this one:
regression <- function(analysis_data,formula) {
print(xtable(etable(feols(fml = formula,
data = analysis_data
, cluster = ~ cluster_var)
,
keep = c("var1", "var2")), type = "html", include.rownames = F))
}
My rmarkdown chunk header for the specific chunk that should include the latex table into the html document is the following:
{r chunk1, eval = T, echo = F, warning=FALSE, out.width= "150%", message = F, results='asis'}
And my general header of the rmarkdown document is:
---
title: "Title"
#author: "My name"
output: html_document
editor_options:
chunk_output_type: inline
---
<style>
div.hidecode + pre {display: none}
</style>
<script>
doclick=function(e){
e.nextSibling.nextSibling.style.display="block";
}
</script>
I also tried varying my regression function to (using the same chunk header where results = 'asis'
) without success:
regression <- function(analysis_data,formula) {
etable(feols(fml = formula,
data = analysis_data
, cluster = ~ cluster_var)
,
keep = c("var1", "var2"), tex = T)
}
Any help is highly appreciated!