我有4个数据帧,我想在选择&#34时打印两个数据帧a1和a2;未检测到夹紧杆关闭 - 错误编号7/31"来自selectInput
选项,但它在selectInput
分为两个选项,如未检测到夹紧杆关闭 - 错误编号7/311"并且未检测到夹紧杆关闭 - 错误编号7/312"与数据帧b1和b2相同的情况。
在第二个表格中,即a2和b2我想上传文字,我可以上传它但是我没有在选择&#34时获得表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)
答案 0 :(得分:0)
在我的代码中做了一点改动,我得到了我想要的答案。 Yiipee:)
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)
new <- list(a1, a2)
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)
new1 <- list(b1,b2)
selectInput("error", strong("ERROR MESSAGE:", style = "color:brown" ),
choices =c("Clamping lever closing not detected-Error number 7 / 31"= "new",
"Door is open (Timeout key)-Error number 15 / 100"= "new1")
),
selected = NULL
)