TeX - LaTeX Asked on February 22, 2021
I used to work with stargazer, but this package (vtable) is better for making summarization by groups. I choose "latex" as out and the following table was generated. However, my overleaf article did not recognize the table as several erros appeared. What am I doing wrong?
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{graphics}
usepackage[export]{adjustbox}
usepackage[margin=1in]{geometry}
usepackage{tikz}
usepackage{booktabs}
usepackage{tabularx}
usepackage{amssymb}
usepackage{hyperref}
usepackage{array}
begin{document}
begin{table}[!htbp] centering
renewcommand*{arraystretch}{1.1}
resizebox{textwidth}{!}{
caption{Summary Statistics}
begin{tabular}{lrrrrrrr}
hline
hline
Variable & multicolumn{1}{c}{N} & multicolumn{1}{c}{Mean} & multicolumn{1}{c}{Std. Dev.} & multicolumn{1}{c}{Min} & multicolumn{1}{c}{Pctl. 25} & multicolumn{1}{c}{Pctl. 75} & multicolumn{1}{c}{Max}
hline
multicolumn{8}{c}{aliado: 0}
ano & 36423 & 2008.478 & 4.945 & 2000 & 2005 & 2012 & 2018
orientacao & 36423 & & & & & &
... Centro & 8337 & 22.9% & & & & &
... Direita & 14578 & 40% & & & & &
... Esquerda & 13508 & 37.1% & & & & &
code & 36423 & 3216561.645 & 971270.128 & 1100023 & 2506103 & 4109302 & 5222302
code_6 & 36423 & 321655.708 & 97127.013 & 110002 & 250610 & 410930 & 522230
servico & 36423 & & & & & &
... Água & 26633 & 73.1% & & & & &
... Água e Esgoto & 9782 & 26.9% & & & & &
... Esgoto & 8 & 0% & & & & &
paralisacao_duracao & 9470 & 29.03 & 220.606 & 0 & 6.67 & 14 & 6668.44
intermitencia_duracao & 5296 & 66.535 & 595.074 & 0 & 3.2 & 13 & 31542.86
cloro_residual & 28060 & 4.887 & 14.346 & 0 & 0 & 2.24 & 100
turbidez & 28145 & 7.053 & 17.494 & 0 & 0 & 4.12 & 100
reparos_esgotos_duracao & 3956 & 12.598 & 41.359 & 0 & 1.85 & 11 & 1213.02
servico_duracao & 15046 & 53.879 & 289.9 & 0 & 1.03 & 58.373 & 22861.5
& & & & & & &
multicolumn{8}{c}{aliado: 1}
ano & 7256 & 2007.959 & 4.923 & 2000 & 2004 & 2012 & 2018
orientacao & 7256 & & & & & &
... Centro & 3300 & 45.5% & & & & &
... Direita & 314 & 4.3% & & & & &
... Esquerda & 3642 & 50.2% & & & & &
code & 7256 & 3185174.31 & 981385.162 & 1100049 & 2413557 & 4127304 & 5221700
code_6 & 7256 & 318516.978 & 98138.517 & 110004 & 241355 & 412730 & 522170
servico & 7256 & & & & & &
... Água & 5809 & 80.1% & & & & &
... Água e Esgoto & 1443 & 19.9% & & & & &
... Esgoto & 4 & 0.1% & & & & &
paralisacao_duracao & 1395 & 36.507 & 247.343 & 0 & 6 & 16 & 4568.29
intermitencia_duracao & 753 & 66.844 & 714.663 & 0 & 3 & 12 & 18360
cloro_residual & 5144 & 5.345 & 14.739 & 0 & 0 & 2.872 & 100
turbidez & 5120 & 8.025 & 17.778 & 0 & 0 & 6.005 & 100
reparos_esgotos_duracao & 396 & 33.269 & 68.916 & 0 & 2 & 21.088 & 405.98
servico_duracao & 2516 & 66.857 & 396.499 & 0 & 1 & 49.752 & 14540.2
hline
hline
end{tabular} %
}
end{table}
end{document}
To get rid of the error message, place the caption
command outside of the resizebox
. Even better would be removing the resizbox
alltogether since the use of it on tables will only result in inconsistent font sizes throughtout the document. Additonally, your table already is as wide as the textwidth, so resizebox` does not have any effect here.
In the following MWE, I also replaced the hline
commands with lines from the booktabs
package, that you already loaded. I also made some commented changes to your preamble:
documentclass{article}
%usepackage[utf8]{inputenc}% not needed any more in a recent installation
%usepackage{graphics}% replaced with graphicx
usepackage{graphicx}
usepackage[export]{adjustbox}
usepackage[margin=1in]{geometry}
usepackage{tikz}
usepackage{booktabs}
usepackage{tabularx}
usepackage{amssymb}
%usepackage{array}% already loaded by tabularx.
usepackage{hyperref} % Should, with just a few exceptions, be the last package in your preamble
begin{document}
begin{table}[!htbp]
centering
caption{Summary Statistics}
begin{tabular}{lrrrrrrr}
toprule
Variable & multicolumn{1}{c}{N} & multicolumn{1}{c}{Mean} & multicolumn{1}{c}{Std. Dev.} & multicolumn{1}{c}{Min} & multicolumn{1}{c}{Pctl. 25} & multicolumn{1}{c}{Pctl. 75} & multicolumn{1}{c}{Max}
midrule
multicolumn{8}{c}{aliado: 0}
midrule
ano & 36423 & 2008.478 & 4.945 & 2000 & 2005 & 2012 & 2018
orientacao & 36423 & & & & & &
... Centro & 8337 & 22.9% & & & & &
... Direita & 14578 & 40% & & & & &
... Esquerda & 13508 & 37.1% & & & & &
code & 36423 & 3216561.645 & 971270.128 & 1100023 & 2506103 & 4109302 & 5222302
code_6 & 36423 & 321655.708 & 97127.013 & 110002 & 250610 & 410930 & 522230
servico & 36423 & & & & & &
... Água & 26633 & 73.1% & & & & &
... Água e Esgoto & 9782 & 26.9% & & & & &
... Esgoto & 8 & 0% & & & & &
paralisacao_duracao & 9470 & 29.03 & 220.606 & 0 & 6.67 & 14 & 6668.44
intermitencia_duracao & 5296 & 66.535 & 595.074 & 0 & 3.2 & 13 & 31542.86
cloro_residual & 28060 & 4.887 & 14.346 & 0 & 0 & 2.24 & 100
turbidez & 28145 & 7.053 & 17.494 & 0 & 0 & 4.12 & 100
reparos_esgotos_duracao & 3956 & 12.598 & 41.359 & 0 & 1.85 & 11 & 1213.02
servico_duracao & 15046 & 53.879 & 289.9 & 0 & 1.03 & 58.373 & 22861.5
midrule
multicolumn{8}{c}{aliado: 1}
midrule
ano & 7256 & 2007.959 & 4.923 & 2000 & 2004 & 2012 & 2018
orientacao & 7256 & & & & & &
... Centro & 3300 & 45.5% & & & & &
... Direita & 314 & 4.3% & & & & &
... Esquerda & 3642 & 50.2% & & & & &
code & 7256 & 3185174.31 & 981385.162 & 1100049 & 2413557 & 4127304 & 5221700
code_6 & 7256 & 318516.978 & 98138.517 & 110004 & 241355 & 412730 & 522170
servico & 7256 & & & & & &
... Água & 5809 & 80.1% & & & & &
... Água e Esgoto & 1443 & 19.9% & & & & &
... Esgoto & 4 & 0.1% & & & & &
paralisacao_duracao & 1395 & 36.507 & 247.343 & 0 & 6 & 16 & 4568.29
intermitencia_duracao & 753 & 66.844 & 714.663 & 0 & 3 & 12 & 18360
cloro_residual & 5144 & 5.345 & 14.739 & 0 & 0 & 2.872 & 100
turbidez & 5120 & 8.025 & 17.778 & 0 & 0 & 6.005 & 100
reparos_esgotos_duracao & 396 & 33.269 & 68.916 & 0 & 2 & 21.088 & 405.98
servico_duracao & 2516 & 66.857 & 396.499 & 0 & 1 & 49.752 & 14540.2
bottomrule
end{tabular} %
end{table}
end{document}
Correct answer by leandriis on February 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP