Hopefully I can do a good job explaining what I'm trying to accomplish. Here is a very simple script:
library(shiny)
data("mtcars")
ui <- fluidPage(
selectInput("cyl", "Cyl", choices = unique(sort(mtcars$cyl))),
selectInput("mpg", "Mpg", choices = unique(sort(mtcars$mpg))),
div(style="display:inline-block", textInput(('set_name'), label = 'Dataset Name',width = 200)),
div(style="display:inline-block", actionButton(('select_group'),icon = icon('save'), label = 'Select Dataset')),
DT::dataTableOutput("tbl")
)
server <- function(input,output,session) {
compileData <- reactive({
res <- mtcars %>% filter(cyl == input$cyl & mpg == input$mpg)
})
output$tbl <- DT::renderDataTable({
compileData()
})
}
shinyApp(ui,server)
You will notice that there is a textInput
and an actionButton
that in the context of this script, have no use, which is where help would come in.
Let's say I set the input for cyl to 6 and the input for mpg to 21. It will return a value of two rows. Now let's say I want to save that selection for future reference by using the set_name
input calling it "Sample1", and when I hit the select_group
button, it then stores that selection and it's input into say, a checkbox. Then I select cyl = 8 and mpg = 10.4. That's another two rows, and then I name that "Sample2", hit the button, and then it goes to the same checkbox group where Sample1 lives. From there I can then compare both sets of data against each other. Theoretically, I'd be able to do this with as many samples as I need.
What would be the most effective way of going about this?