I’m working in a R notebook and I’d like to add some interactivity using shiny. So, I need that the user provide some text in an input field. Then, this text will used in different R chunks in the notebook. However, I wasn’t able to find the best way to do this. Here is an example of what I’m trying to do:
---
title: "R Notebook"
output: html_document
runtime: shiny
---
```{r}
data <- reactive({
as.character(input$my_mol)
})
```
```{r}
textInput("my_mol", "Please provide an ID", "MyID_1")
```
```{r}
renderPrint(data())
# is there any way to get the text output in a variable and using it in a different R chunk?
#something like:
#my_output <- renderPrint(data())
```
```{r}
# Then, I'd like to using it on this R chunk
#pba3 <- fromJSON(paste0(baseur_sim, url_encode(my_output), ".json?limit=50"), flatten=TRUE)
```
Thanks!