I essentially have a two tiered group of options I would like to make possible to select from as parameters in an Rmarkdown file. I am familiar with using parameters, but would like to make the selection options of parameter 2 depend on what is selected as parameter 1:
Here is how I imagined it would play out if this was a trivial thing to accomplish:
Example YAML
---
title: "Report with Reactive Parameters"
author: "Mr/Mrs. Scientist"
date: "Updated on: `r Sys.Date()`"
output:
html_document:
toc: TRUE
params:
parent_group:
label: "Select the Larger Collection"
value: "collection 1"
input: select
choices: ["collection 1", "collection 2", "collection 3 that is much larger"]
child_selection:
label: "Select a Specific Option from Parent Group:"
value: "child option 1"
input: select
choices: !r my_package::children_of_parents(parent_group = params$parent_group)
---
In this hypothetical example there are larger categories or "parent_groups" that a user would select first, and based on that choice the second selection options or "child_selections" would change.
I included the line involving my_package::children_of_parent() just to demonstrate how I had planned to access the selection choices. Literally just a function that takes a string as input and returns the appropriate vector of choices.