I have a simple shiny app:
#ui.r
navbarPage(
"Application",
tabPanel("General",
sidebarLayout(
sidebarPanel(
uiOutput("book3"),
uiOutput("book2")),
mainPanel(
DT::dataTableOutput("hot3")
)
)))
#server.r
library(shiny)
library(DT)
library(tidyverse)
server <- function(input, output,session) {
output$book2 <- renderUI({
selectInput("bk2", "Marginal", choices=c("Marg1","Marg2","Marg3"),selectize = FALSE)
})
output$book3<-renderUI({
selectInput("bk3",
"Label",
choices=(rt5()[,1]))
})
rt5<-reactive({
DF=data.frame(
Label=paste("Test",1:3),
Marg=input$bk2,
stringsAsFactors = FALSE
)
})
output$hot3 <-DT::renderDataTable(
rt5()
)
}
I want to be able to select a Test
from the selectInput()
"Label" and then only the relative Marg
of this row to change accordinlly to the name that is set in the selectInput()
"Marginal". For example if I choose Label->Test 2 and Marginal -> Marg 2 only the Marg in the second row of the table should be named like this and the rest should remain the same. In the current condition everything changes.