Is there a way to specify a nested group of params in RMarkdown YAML? If not, should there be?

I would quite like to do something like the following in an RMarkdown YAML header:

---
params:
  weightings:
    a: 11
    b: 12
    ...
---

so that I could then do this in the body of the document:

weightings <- unlist(params$weightings)

rather than

weightings <- c(params$weightings$a, params$weightings$b, ...)

Of course that YAML approach above doesn't work for params, because when you indent under params you are expected to be providing labels and values for the Shiny parameters interface.
Does anyone else think that such a nesting feature for params would be useful? Or is there a way to do this currently, that I haven't thought of?

My best approach currently would be something like:

---
params:
  weighting_a: 11
  weighting_b: 12
  ...
---
weightings <- unlist(subset(params, grepl("^weighting", names(params))))

This is a bit hidden as usually params are designed for only one parameter in YAML but you could do it this way :

params:
  weightings:
    value:
      a: 11
      b: 12

This is because when subfields are passed to the main param key, it will trigger shiny inputs. See

So the value fields must be expected.

Another hidden trick is to use yaml package feature !exprto pass R code

params:
  weightings: !expr list(a = 11, b = 12)

That would be how you would pass the parameter in rmarkdown::render(... , params = list( weightings = list(a = 11, b = 12)))

This should solve your issue