2016-12-19 50 views
0

我想使用upateRadioButtons來清除所有的RadioButtons輸入選擇。我閃亮的應用程序使用幾個RadioButtons作爲輸入,但只有第一個使用updateRadioButton時被清除。所有其他RadioButton都保留在最後的選擇中。Shiny updateRadioButtons

UpdateInputs <- function(data, session) { 
    updateRadioButtons(session, "var1", 
        choices = list("zero" = 0, "one" = 1, "two" = 2, "three" = 3, "four" = 4), 
        selected = character(0), inline=T) 
    updateRadioButtons(session, "var2", 
        choices = list("zero" = 0, "one" = 1, "two" = 2, "three" = 3, "four" = 4,  
    selected = character(0), inline=T) 
} 
+0

'selected = character(0)'看起來有點可疑。 –

回答

2

我發現以下解決方案: 替換

selected = character(0) 

通過

selected = "" 

的伎倆。