0
下面我有一個R代碼,它接受來自numericInput對象的輸入值並將其存儲在Excel電子表格中。我現在試圖有兩個numericInput,但我不知道該怎麼做。在代碼的下面,我試圖只複製對象作爲最後的手段,但它給了我一個錯誤。 (我並不感到驚訝)有什麼建議?如何在R中輸入兩個數字輸入
library(shiny)
library(xlsxjars)
library(rJava)
library(xlsx)
ui <- fluidPage(
numericInput(inputId = "num",
label = "Choose a number",
min = 0, max = 1000000, value = 1),
actionButton(inputId = "submit",
label = "Submit"),
numericInput(inputId = "num2",
label = "Choose a number2", min = 0, max = 1000000, value = 1),
)
server <- function(input, output) {
options(java.parameters = "- Xmx1024m")
wb <- loadWorkbook(file = "F:\\RProject-Rough\\DirectEffect.xlsx")
sheet<-getSheets(wb)
observeEvent(input$submit, {
addDataFrame(c(input$num,input$num2), sheet$'Direct Effects',
col.names = FALSE, row.names = FALSE, startRow = 3,startColumn = 5)
saveWorkbook(wb,"F:\\RProject-Rough\\DirectEffect.xlsx")
})
}
shinyApp(ui = ui, server = server)
哦,太感謝你了。對於愚蠢的錯誤感到抱歉。 – magicmykh