In RStudio, when i go for convert my Markdown file to PDF then it gives me the error:
output file: report.knit.md
! Package inputenc Error
I know I am a bit late for this, but I just had almost the same error (minus the pandoc part).
The problem was that I copy pasted a sentence from wikipedia, which had a dash character which was not utf8 formatted. I replaced the dash and it worked.
Latex fails (with an encoding error) to create a pdf if there are "special" characters in your document, like incorrect whitespace/newline characters, or characters with accents. An easy way to check copy-pasted text is to first paste it into a very basic text editor, like nedit.