How can I modify yaml instructions outside of the document I am rendering

Hello,
please excuse the cross posting, I posted the same question on SO: https://stackoverflow.com/questions/59699249/how-can-i-modify-yaml-instructions-outside-of-the-document-i-am-rendering but the answer I got is to recreat a file by prepending yaml instructions to the R file I want to knit.
I am hoping that given Rmarkdown is a RStudio creation I might get a more satisfying answer on RS Community

Please provide a reproducible example, called a reprex

Hello, the following could be used

---
title: "Sample Document"
output:
  html_document:
    toc: true
    theme: united
  pdf_document:
    toc: true
    highlight: zenburn
---

#' # Title
Hello world

#+ one_plus_one
1 + 1

Thanks!

So, this is an Rmd file. Let's say it's a template that's been used for one or more files and you want to change zenburn to tango?

There are a variety of ways to do this: R, Python, Perl, sed, awk, flex/Bison, Go, C, C++, Haskell, Ruby, depending on your preferred tool set. It's a matter of reading in the existing Rmd file, making the desired transformations and writing the changes back to the file.

If what you mean is totally omitting any yaml at all, you wind up with

[WARNING] This document format requires a nonempty element.
Defaulting to 'YAML.utf8' as the title.
To specify a title, use 'title' in metadata or --metadata title="...".

And, of course, there are no other defaults mentioned in the error.

So that's the extent to which you can knit a plain text file. If you want to keep yaml separately from the plaintext or in command line arguments, it will have to be scripted to bring the together beforehand. As in the previous example, there's endless ways to do this depending on your toolkit and preferred workflow.