I raised a question on stack overflow about how RStudio reorders the YAML document type arguments on generation. I've checked today and it's still reproducible on Mac OS X 10_12_4 using Version 1.0.153
A reasonable answer was provided (though it's somewhat beyond my ability to understand how technically correct it is).
I was wondering if the devs had an opinion on if this was by design, an uncontrollable side-effect or a feature, and if there were any other opinions from the community?
1 Like
The reason it does this has mostly to do with the rmarkdown package, which relies on the ordering in the YAML in order to determine which output format to render by default.
When you click e.g. "Knit to PDF", RStudio does two things:
- Makes PDF the default output format by moving it to the top
- Knits the document to the default output format
In most cases this is the behavior people want, because it enables quick iteration (now the next time you click Knit, you get a PDF.)
It would be possible for the IDE to decouple these things, and render to a format without making it the default. However, it's not the majority case so isn't currently implemented.
2 Likes
Thanks, clears it up nicely
Like @DaveRGP, I also find the reordering of YAML an annoying feature of the IDE. I often work in one format primarily, knitting alternate formats every now and then. Having the last format knitted always being the default is frustrating not just from a clicking-knit-again-doesn't-do-what-I-want, but makes version control messier than it needs to be. Other members of my team, particularly newer R and git users, are constantly tripping over this.
Is a feature request on the RStudio repo the best place to advocate for implementing a sticky "default" knit option for the IDE? Would eliminate a minor, but constant, annoyance in a tool that I love so much!