1

I have the following codes in rmarkdown but the output does not show the table at all. basically, the output for the table is blank. I have no idea how to solve this

title: "Title"
output:
  html_document: default
  pdf_document: default
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{amsthm}
- \usepackage{amsmath}
- \usepackage{amsfonts}
- \usepackage{amscd}
- \usepackage{amssymb}

## Table

See the following table :


\begin{table}[h]
\begin{tabular}{|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Hospital}}} &
  \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Severity}}} &
  \multicolumn{2}{c|}{\textbf{Outcome}} &
  \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Total}}} \\ \cline{3-4}
\multicolumn{1}{|c|}{} &
  \multicolumn{1}{c|}{} &
  \multicolumn{1}{c|}{\textbf{Success}} &
  \multicolumn{1}{c|}{\textbf{Failure}} &
  \multicolumn{1}{c|}{} \\ \hline
\multirow{2}{*}{\textbf{Better}} & \textbf{Less severe} & 18 & 2  & 20 \\ \cline{2-5} 
                                 & \textbf{More severe} & 32 & 48 & 80 \\ \hline
\multirow{2}{*}{\textbf{Normal}} & \textbf{Less severe} & 64 & 16 & 80 \\ \cline{2-5} 
                                 & \textbf{More severe} & 4  & 16 & 20 \\ \hline
\end{tabular}
\end{table}
domath
  • 172
  • 5

1 Answers1

1

Use the edited yaml header below will show the table in pdf output. You can try the link shared in comment to get it work for html output.

---
title: "Title"
output: pdf_document
header-includes:
  - \usepackage{booktabs}
  - \usepackage{longtable}
  - \usepackage{array}
  - \usepackage{multirow}
  - \usepackage{amsthm}
  - \usepackage{amsmath}
  - \usepackage{amsfonts}
  - \usepackage{amscd}
  - \usepackage{amssymb}
---

enter image description here

OceanSky_U
  • 349
  • 3
  • 12