我正在做一个调查,我指的是这个
Shiny CRUD app
在Github上,这个方法很好,直到我有一个关于单选按钮的问题。
在UI中有一个新的输入字段
radioButtons("Question1","Question1", choices = c("Y","N","NA"),inline=T),
我更改了下面的CRUD函数,以适应上面的输入字段。
# Cast from Inputs to a one-row data.frame
CastData <- function(data) {
datar <- data.frame(name = data["name"],
used_shiny = as.logical(data["used_shiny"]),
r_num_years = as.integer(data["r_num_years"]),
Question1 = data["Question1"],
stringsAsFactors = FALSE)
rownames(datar) <- data["id"]
return (datar)
}
# Return an empty, new record
CreateDefaultRecord <- function() {
mydefault <- CastData(list(id = "0", name = "", Question1 = "Y",used_shiny = FALSE, r_num_years = 2))
return (mydefault)
}
# Fill the input fields with the values of the selected record in the table
UpdateInputs <- function(data, session) {
updateTextInput(session, "id", value = unname(rownames(data)))
updateTextInput(session, "name", value = unname(data["name"]))
updateCheckboxInput(session, "used_shiny", value = as.logical(data["used_shiny"]))
updateRadioButtons(session, "Question1",value = unname(data["Question1"]))
updateSliderInput(session, "r_num_years", value = as.integer(data["r_num_years"]))
}
当我跑步时,我会出错”
警告:UpdateRadioButtons中的错误:未使用的参数(值=未命名(数据[“Question1”]))
“
无法修复此问题