Using a new empty .rmd document, this code works:
 \\begin{center} \\includegraphics[width=4in]{RainbowDolphin.png} \\end{center}
It's because the latex template doesn't load the graphicx package by default. You can do it manually by adding this to the yaml header:
--- title: "Untitled" header-includes: \usepackage{graphicx} output: pdf_document: keep_tex: true ---