【发布时间】:2020-12-10 08:32:58
【问题描述】:
在一个闪亮的应用程序中,我有一个 varSelectInput 小部件来从 iris 数据集中选择变量。有没有办法可以将 varSelectInput 中的变量限制为仅限数字变量。我尝试使用 is.numeric(iris),但没有成功。谢谢。
我的代码:
library(shiny)
library(ggplot2)
# single selection
shinyApp(
ui = fluidPage(
varSelectInput("variable", "Variable:", is.numeric(iris),
selected = NULL),
plotOutput("data")
),
server = function(input, output) {
output$data <- renderPlot({
ggplot(iris, aes(!!input$variable)) + geom_histogram()
})
}
)
【问题讨论】: