0
votes

I'm trying to incorporate an Rmd I have been using into a flexdashboard. I'm curious if it is possible to isolate an uploaded file and use it as-is rather than writing a bunch of reactive functions. If this is my template, is it possible to get a static object named df that the child document can go ahead and run with?

---
title: "help"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
---

```{r}
fileInput("data", "select data")

df <- isolate(input$data)
```

```{r, child="some_code.Rmd"}
```

My real example does something completely different but let's say some_code.Rmd looks like this:

---
title: "some code"
output: html_document
---

```{r packages, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
library(tidyverse)
```

The data looks like this:
```{r}
as_tibble(df)
```

The numeric data can be summarized with the following means
```{r}
df |> 
  summarise(across(where(is.numeric), mean)) |> 
  gather()
```