0
データフレームが4つあり、「クランプレバーが検出されない - エラー番号7/31」を選択すると、データフレームa1とa2の2つを印刷したいのですが、selectInput
の選択肢から2つのオプションに分割されますselectInput
クランプレバー閉じない - エラー番号7/311 "およびクランプレバーが閉じていない - エラー番号7/312"、データフレームb1およびb2の場合と同じです。Shiny AppのselectInput()から選択肢の1つを選択して2つのテーブルを印刷するには?
2番目のテーブル、つまり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)