I had faced this problem in the past while I was trying to add an in-line r code r test1$p.value, which is a very small p-value from t test.
The error information is as bellow:
> ! Missing $ inserted.
> <inserted text>
>pandoc: Error producing PDF
>Error: pandoc document conversion failed with error 43
I guess the problem is the pdflatex engine that has a trouble in displaying the small p-value in exponential notation. I resolved the issue by clicking on the gear symbol next to the knit button. After that the under the output options, advanced tab I changed the LaTeX Engine to lualatex, or you can just report the p-value as p < 0.001.
And my problem got fixed.