Hi people!
I'm trying to create a box with many values of "inputs", like this:
But, my first input is called that way:
UI -> uiOutput("iGrau")
Server:
output$iGrau <- renderUI({
materials <- df$GRAU
selectInput(
"graudoaco",
label = "Grade",
choices = 'materials',
multiple = T
)
})
So, the input "iGrau" allows the user to select MULTIPLES values, and when it happens, the following error appears:
How can I work in my code to avoid the problem with the number of rows? I need to pass all the selected options in the first input like one unique value. I tried to use "paste", but i might had done something wrong.
entradasmanuais <- reactive({
data.frame(
Nome = c("Grade:",
"Steel:",
"Norm:",
"PPK:",
"CPK:",
"QualquerCoisa:"
),
Valores = (c(input$iGrau, <-----------This input allow many values-----
input$iLIMMAX,
input$iLIMMIN,
input$iTARGET,
input$testeLIMMAX,
input$testeLIMMIN
)),
stringsAsFactors = FALSE)
})
Could you please turn this into a reprex (with sample data) so we can try to figure out what the problem is?
1 Like
library(shiny)
ui <- fluidPage(
# Application title
titlePanel("Test"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
uiOutput("iGrau"),
numericInput("iLIMMAX", "Upper Limit", 800, min = 0.1, max = 100, step = 0.5),
numericInput("iLIMMIN", "Lower Limit", 400, min = 0.1, max = 100, step = 0.5),
numericInput("iTARGET", "Target", 10, min = 0.1, max = 100, step = 0.5)
),
mainPanel(
tableOutput("entradas3")
)
)
)
server <- function(input, output) {
output$iGrau <- renderUI({
selectInput(
"graudoaco",
label = "Grade",
choices = c('a','b','c'),
multiple = T
)
})
entradasmanuais <- reactive({
data.frame(
Nome = c("Grade:",
"Upper Limit:",
"Lower Limit:",
"Target:"
),
Valores = (c(input$iGrau,
input$iLIMMAX,
input$iLIMMIN,
input$iTARGET
)),
stringsAsFactors = FALSE)
})
output$entradas3 <- renderTable({
entradasmanuais()
})
}
# Run the application
shinyApp(ui = ui, server = server)
Is this what you want to do?
library(shiny)
ui <- fluidPage(
# Application title
titlePanel("Test"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
uiOutput("iGrau"),
numericInput("iLIMMAX", "Upper Limit", 800, min = 0.1, max = 100, step = 0.5),
numericInput("iLIMMIN", "Lower Limit", 400, min = 0.1, max = 100, step = 0.5),
numericInput("iTARGET", "Target", 10, min = 0.1, max = 100, step = 0.5)
),
mainPanel(
tableOutput("entradas3")
)
)
)
server <- function(input, output) {
output$iGrau <- renderUI({
selectInput(
"graudoaco",
label = "Grade",
choices = c('a','b','c'),
multiple = T
)
})
entradasmanuais <- reactive({
data.frame(
Nome = c("Grade:",
"Upper Limit:",
"Lower Limit:",
"Target:"
),
Valores = c(paste(input$graudoaco, collapse = ","),
input$iLIMMAX,
input$iLIMMIN,
input$iTARGET
),
stringsAsFactors = FALSE)
})
output$entradas3 <- renderTable({
entradasmanuais()
})
}
# Run the application
shinyApp(ui = ui, server = server)
1 Like
Thanks man! Exactly what i want.
system
Closed
June 6, 2019, 12:53pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.