Hi All,
I want to create a data table where 1st column is "test" 2nd column is "select" and my 3rd column is "result". In the 1st column I have test names like : "day2_vs_day3", "day6_vs_day7", "day9_vs_day10" , my 2nd column is "yes" or "no". So each test name has selectInput "yes" or "no" if selection is "yes" then the test name should be as it is copy to 3rd column, if selection is "no" then test name should be reverse like : if "day2_vs_day3" is selected as "no" then in the 3rd column it should print as "day3_vs_day2". Please find the below shared code.
library(shiny)
library(DT)
ui <- fluidPage(
fluidRow(DTOutput(outputId = "table"))
)
server <- function(input, output, session) {
name <- c("day2_vs_day3", "day6_vs_day7", "day9_vs_day10")
output$table <- renderDT({
data <- data.frame(test = name,
select = '<select id="name" style="width: 50%;">
<option value="yes">yes</option>
<option value="no">no</option> </select>',
stringsAsFactors = FALSE)
datatable(data = data,
selection = "none",
escape = FALSE, rownames = FALSE) })
}
shinyApp(ui = ui, server = server)
The test names are dynamic it changes as input change. So as per the test name the selectinput will create automatically for each test name. For each selection "yes" or "no" the 3rd column will show the result.
Any help or suggestions will be appreciated. Thank you for your time and help!