0
我有4個數據幀,我想從selectInput
選項中選擇「夾緊槓桿未檢測到關閉 - 錯誤號碼7/31」,但打印兩個數據幀a1和a2,但它分成selectInput
兩個選項,如夾緊槓桿關閉未檢測到 - 錯誤編號7/311「夾緊杆關閉未檢測到 - 錯誤編號7/312」以及與數據框b1和b2相同的情況。如何通過從Shiny App中的selectInput()中選擇一個選項來打印兩個表?
而在第二個表格中,即a2和b2我想上傳文字,我可以上傳它,但是我沒有在表格a1和a2上選擇「未檢測到夾緊杆關閉 - 錯誤編號7/31 」。
a1 <- read.csv(file.path("E:/Puma/Manuals/Smoke tables csv/AT1240E_Smoke_Meter-4.csv"), sep = "," , header = TRUE)
a2 <- read.csv(file.path("E:/Manual/error7.csv"), sep = "," , header = TRUE)
#b1<- read.csv(file.path("E:/Puma/Manuals/Smoke tables csv/AT1240E_Smoke_Meter-21.csv"), sep = "," , header = TRUE)
#b2 <- read.csv(file.path("E:/Manual/error15.csv"), sep = "," , header = TRUE)
library(shiny)
library(shinythemes)
ui <- shinyUI(fluidPage(theme=shinytheme("readable"),
titlePanel(h3("PUMA", style = "color:black")),
sidebarLayout(
wellPanel(
tags$head(
tags$style("body {background-color: pink; }")),
selectInput("error", strong("ERROR MESSAGE:", style = "color:brown"),
choices =c("Clamping lever closing not detected-Error number 7/31"= c("a1", "a2"),
"Door is open (Timeout key)-Error number 15/100"= c("b1","b2")
),
selected = NULL
),
textInput("Possible.cause", label="Add a new Possible.cause ", value=NULL),
textInput("Check", label="Add a new Check", value=NULL),
textInput("Remedy", label="Add a new Remedy", value=NULL),
actionButton("addButton", "UPLOAD!")
),
mainPanel(tabsetPanel(
tabPanel(h2("TABLE", style = "color:brown"), verbatimTextOutput("error")),
tags$head(tags$style("#error{color:navy;
font-size: 17px;
font-style: bold;
font-family: 'Roboto';
background-color: #FFFFFF;
border-radius: 16px !important;
max-height: none;
position: absolute;
text-align: left;
spacing=l;
border-width: bold;
border-style: solid;
border-color: #f44336 !important;
}"))
),
width = 12)
)))
server <- shinyServer(function(input, output){
output$error <- renderPrint ({
get(input$error)
})
values <- reactiveValues()
values$df <- a2
row.names(a2) <- NULL
observe({
if(input$addButton > 0) {
newLine <- isolate(c(input$Possible.cause, input$Check, input$Remedy))
isolate(values$df <- rbind(as.matrix(values$df), unlist(newLine)))
write.csv(values$df,file.path("E:/Manual/error7.csv"), sep = "," ,
row.names = FALSE,append=FALSE)
}
})
})
shinyApp(ui = ui, server = server)