How to set up multiple predict tabs in Rshiny

Having an issue getting multiple predicts set up in the same RShiny application. I have 2 different models, one for each work area I am working with (TRN, STR) that I want to have separate predicts set up for that reference their respective models. Apologies for the messy code, and I only included the server portion of the Rshiny code and not all of the dashboarding info. I am not quite sure how to have separate inputs for the 2 different tabs for the separate models.

Thanks in advance!



# R Shiny server
server <- shinyServer(function(input,TRNinput,output,TRNoutput) {
  
  #Prediction model
  #React value when using the action button
  a <- reactiveValues(result = NULL)
  # a_trn <- reactiveValues(result = NULL)
  
  observeEvent(input$cal, {
    #Copy of the test data without the dependent variable
    test_pred <-select(STRtestShiny,Workcenter,Grade,Length,Diameter)
    
    #Dataframe for the single prediction
    values = data.frame(Workcenter = input$p_workcenter, 
                        Length = input$p_length,
                        Grade = input$p_grade,
                        Diameter = input$p_diameter)
    
    #Include the values into the new data
    test_pred <- rbind(test_pred,values)
    
    #Single preiction using the randomforest model
    a$result <-  round(predict(STRModelValidate, 
                               newdata = test_pred[nrow(test_pred),]), 
                       digits = 0)
  })
  
  #OBSERVE EVENT TURNER
  observeEvent(TRNinput$cal, {
    #Copy of the test data without the dependent variable
    test_pred_trn <-select(TRNtestShiny,Workcenter,Grade,Length,Diameter)
    #test_pred$Workcenter<- str_replace(test_pred$Workcenter, "STRAIGHTENER 1 ", "STRAIGHTENER 1 LOAD")
    #test_pred$Workcenter<- str_replace(test_pred$Workcenter, "STRAIGHTENER 2 ", "STRAIGHTENER 2 LOAD")
    #test_pred$Workcenter<- str_replace(test_pred$Workcenter, "STRAIGHTENER 3 ", "STRAIGHTENER 3 LOAD")

    #Dataframe for the single prediction
    values_trn = data.frame(Workcenter = TRNinput$p_workcenter,
                        Length = TRNinput$p_length,
                        Grade = TRNinput$p_grade,
                        Diameter = TRNinput$p_diameter)

    #Include the values into the new data
    test_pred <- rbind(test_pred_trn,values_trn)

    #Single preiction using the randomforest model
    a_trn$result <-  round(predict(TRNModelValidate,
                               newdata = test_pred_trn[nrow(test_pred_trn),]),
                       digits = 0)
  })
  
  
  
  
  output$value <- renderText({
    #Display the prediction value
    paste(a$result)
  })
  
  TRNoutput$value <- renderText({
    #Display the prediction value
    paste(a_trn$result)
  })

  output$range <- renderText({
    #Display the range of prediction value using the MAE value
    input$cal
    isolate(sprintf('(%s) - (%s)', 
                    round(a$result - STRRSS_Predictions, digits = 0),
                    round(a$result + STRRSS_Predictions, digits = 0)))
  })
  
  TRNoutput$range <- renderText({
    #Display the range of prediction value using the MAE value
    TRNinput$cal
    isolate(sprintf('(%s) - (%s)',
                    round(a_trn$result - TRNRSS_Predictions, digits = 0),
                    round(a_trn$result + TRNRSS_Predictions, digits = 0)))
  })
})

shinyApp(ui, server)

I attempted this code above and the error I received was related to the new input/output variables not having default values. I set them up no different to the first set so I was unsure how to tackle this problem

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật