1

If I have the following code to create a checkbox in an RMarkdown flex_dashboard, how do I access the variables created by the checkbox for later use in the code?

---
title: "Temp Dashboard"
author: "Me"
output: 
   flexdashboard::flex_dashboard:
     orientation: rows
    vertical_layout: scroll
---

```{r global, include=FALSE}
library(htmltools)
theme_set(theme_classic())
```


Column {.sidebar data-width=200}
-------------------------------------

### Filters

<form>
  <input type="checkbox" name="type1" value=1>
  <label for="type1"> Include type1 models</label><br>
  <input type="checkbox" name="type2" value=2>
  <label for="type2"> Include type2 models</label><br><br>
  <input type="submit" value="Go">
</form>

Row
-----------------------------------------------------------------------

```{r}
print(type1)
print(type2)
```

I should also note that I need the values to update in R everytime the Go Button is pushed in the dashboard. I need to avoid using shiny because I'm restricted to an environment with no shiny server. Thanks in advance for any help!

obewanjacobi
  • 458
  • 2
  • 12
  • Your requirements sound impossible: you want to update R values without being able to run R. Or if you can run R but not Shiny, then you'll basically have to re-implement it. – user2554330 Dec 27 '21 at 20:07
  • like @user2554330 said, you can't without `runtime: shiny` – lz100 Dec 27 '21 at 21:15
  • @user2554330 would this be possible using some form of htmltools and crosstalk? – obewanjacobi Dec 27 '21 at 22:14
  • For example would it be possible to do something like this? https://stackoverflow.com/questions/65692254/add-html-and-javascript-code-to-flexdashboard-in-r?noredirect=1&lq=1 – obewanjacobi Dec 27 '21 at 22:17
  • 1
    @obewanjacobi, no, not exactly. Those tools only let you run Javascript. Shiny works by having the Javascript send things to the server where R is running. So if you need to run R they aren't enough. But if you really just want to print some variables that were set in a form, you should be able to do that from Javascript. – user2554330 Dec 28 '21 at 09:20
  • Yeah printing variables isn't actually what I want, I need those objects in R :( so from what you've told me it sounds like this really might be impossible. Man that sucks. But thanks for clarifying. I can stop digging through the rabbit hole and pursue other options at least now. – obewanjacobi Dec 28 '21 at 14:26

0 Answers0