Recently, I am facing this strange issue with the "Knit" button in RStudio. Whenever I try to knit an R Markdown file using the "Knit" button, it uses the "rmarkdown::render_site" function to knit the file. I am trying to knit a single .Rmd file, and not a bookdown book or site. Thus, this function creates a _main.Rmd file in the default working directory. This happens even when I am working inside an RStudio project, and irrespective of any output format I choose (PDF/HTML/Word).
However, if I add extra line in YAML header like following, then I can knit a PDF from the .Rmd file.
--- knit: rmarkdown::render ---
I contacted the developer Yihui Xie over github, and he suggested me to take help from this wonderful community. He also pointed me out to an article, so that I can access the RStudio preferences. But I don't know which setting I need to change in which particular file.