how to produce pdf-latex file by knitr

You do expect wonders from the RStudio Community, aren’t you:
just specify the output and let us determine the input.

It is not clear what you want to achieve but maybe the article
Produce LaTeX from Rmarkdown gives you some ideas.