[Tex/LaTex] How to combine multirow and multicolumn in simplest example

multicolumnmultirowtablestexshop

I am facing problem to combine multicolumn and multirow together in a table. Anyone help what should be the latex code for below table?

tex

Update

I have tried some code,

\begin{tabular}{|c|c|cc|}
    \hline
\multicolumn{2}{|c|}{}  &   \multicolumn{2}{c|}{C}  \\
    \cline{3-4}
\multicolumn{2}{|c|}{R}&   true    &   false       \\
    \hline
\multirow{2}{*}{R}      &   true    &   1   &   1   \\
\hline
            &   false   &   2       &   3           \\
    \hline
\end{tabular}

Output:
enter image description here

It's splitting the row. And I don't know how to make column margin at the top.

Best Answer

Probably one of the following suggestion helps:

enter image description here

\documentclass{article}
\usepackage{multirow}
\begin{document}

\begin{tabular}{|c|c|c|}
\hline
\multirow{2}{*}{R} & \multicolumn{2}{c|}{C} \\ \cline{2-3}
                   & C1 & C2               \\ \hline
r1                 & a  & b                \\ \hline
r2                 & a  & b                \\ \hline
\end{tabular}



\begin{tabular}{|c|c|c|c|}
    \hline
\multicolumn{2}{|c|}{\multirow{2}{*}{R}}  &   \multicolumn{2}{c|}{C}  \\
    \cline{3-4}
\multicolumn{2}{|c|}{}                    &   true    &   false       \\
    \hline
\multirow{2}{*}{R}      &   true          &   1       &   1           \\
\cline{2-4}
                        &   false         &   2       &   3           \\
    \hline
\end{tabular}
\end{document}