Hi
Hope something like this helps
library(shiny)
library(shinydashboard)
ui <- fluidPage(
box(
width = 4,height = "350px",align='center',
HTML(paste('
',"1st Week Process ID",'
')),
splitLayout(cellWidths = c("25%","25%"),
numericInput(inputId = "week1startid",label = "Starting ID",value = 0,width = "100px"),
numericInput(inputId = "week1endid",label = "Finishing ID",value = 0,width = "100px")
),
HTML(paste('
',"2nd Week Process ID",'
')),
splitLayout(cellWidths = c("25%","25%"),
numericInput(inputId = "week2startid",label = "Starting ID",value = 0,width = "100px"),
numericInput(inputId = "week2endid",label = "Finishing ID",value = 0,width = "100px")
),
HTML(paste('
',"3rd Week Process ID",'
')),
splitLayout(cellWidths = c("25%","25%"),
numericInput(inputId = "week3startid",label = "Starting ID",value = 0,width = "100px"),
numericInput(inputId = "week3endid",label = "Finishing ID",value = 0,width = "100px")
),
HTML(paste('
',"4th Week Process ID",'
')),
splitLayout(cellWidths = c("25%","25%"),
numericInput(inputId = "week4startid",label = "Starting ID",value = 0,width = "100px"),
numericInput(inputId = "week4endid",label = "Finishing ID",value = 0,width = "100px")
),
actionButton(inputId = "mprocess",label = "Click me!")
),
box(width = 8,
height = "350px",
tableOutput(outputId = "mdatatable")
)
)
server <- function(input, output, session) {
vvr <- reactiveValues(mydata=NULL)
observeEvent(input$mprocess,{
vvr$mydata <- data.frame(Process_ID = seq(from=65000,to=80000,by=100))
vvr$mydata$Week_ID <- 0
vvr$mydata$Week_ID <- ifelse(vvr$mydata$Process_ID >= input$week1startid & vvr$mydata$Process_ID < input$week1endid,1,
ifelse(vvr$mydata$Process_ID >= input$week2startid & vvr$mydata$Process_ID < input$week2endid,2,
ifelse(vvr$mydata$Process_ID >= input$week3startid & vvr$mydata$Process_ID < input$week3endid,3,
ifelse(vvr$mydata$Process_ID >= input$week4startid & vvr$mydata$Process_ID < input$week4endid,4,0 ))))
})
output$mdatatable <- renderTable({
vvr$mydata
})
}
shinyApp(ui, server)