Q: Why does the Knit drop-down in RStudio disappear when I add a knit option to the YAML header of my R Markdown file?
Normally I see the Knit button with drop-down option (like this ) when viewing a .Rmd in RStudio, . But the drop-down option disappears (so I only see
) after I add the following code to the YAML header in my .Rmd:
knit: (function(inputFile, encoding) {
rmarkdown::render(inputFile, encoding = encoding, output_dir = "../output") })
I add that code because I want my output to go to a different directory than my source .Rmd.
I can change the ordering of my output
fields (e.g., pdf_document
, word_document
) to Knit (without drop-down) to get a .pdf or .docx as I need. But go back and forth between the two often. So this work-around becomes very tedious.
This question appears to relate to What does “Knit HTML” do in Rstudio 0.98? and Knit Directory drop down menu.