My error message gives me the following:
An error occurred while running: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.1/Resources/scripts/lyxknitr.R" "C:/Users/msl0/AppData/Local/Temp/lyx_tmpdir.FReZDFD13868/lyx_tmpbuf0/""knit... 22:31:17.653: Error while exporting format: PDF (pdflatex)