Diagnosing R Package build Error: pdfLatex Not Available
Just follow this video's instructions to install MikTex on windows:
https://www.youtube.com/watch?v=k-xSGZ-RLBU
I also had similar problems about pdfLatex Not Available. After installing MikTex this way, errors like "pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41" can be solved when creating pdf using knitr.
The installation file can be downloaded from:
http://mirrors.ctan.org/systems/win32/protext/ProTeXt-3.1.5-033015.exe
Although you have installed MikTeX under Windows, this does not make it available to R. You need to add the location of the latex executables to your PATH environment variable. How to do this exactly depends on your Windows version. For example, this link describes how to do this for Windows 7. Googling for change environment variables (windows 7|windows xp|windows 95)
will tell you how to change your environment variables.
Step 1: Download and Install MiKTeX from http://miktex.org/2.9/setup
Step 2: Run
Sys.getenv("PATH")
in R studio This command returns the path where Rstudio is trying to find pdflatex.exe In windows (64-bit) it should return C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe If pdflatex.exe is not located in this location Rstudio gives this error code 41.
Step 3: To set this path variable run:
Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:/Program Files/MiKTeX 2.9/miktex/bin/x64/",sep=";"))
you certainly can suppress the PDF generation.
R CMD check package --no-manual
From here