In LaTeX I can create conditionals in the following manner
\iftoggle{ebook}{
\newcommand{\textbreak}{\newline\hrule\newline}
}{
\newcommand{\textbreak}{\begin{center}\LARGE{$\Psi\quad\Psi\quad\Psi$}\end{center}}
}
Can I do the same while knitting R Markdown, depending on if the output, is say HTML or PDF.