【发布时间】:2019-05-20 08:43:04
【问题描述】:
我正在努力编写这个闪亮的应用程序。它的主要目的是研究数据集的变量。首先,它生成所选变量的汇总统计信息。
在第二部分;我希望这个应用程序为我提供我在 UI 的复选框中选择的变量的配对图。我使用了所有人都可以使用的数据集 IRIS,但我需要代码能够适应其他数据集。
有人可以帮帮我吗?
library(shiny)
library(plotly)
data(iris)
ui<-fluidPage(
titlePanel("Iris"),
sidebarLayout(
sidebarPanel(
selectInput("var",label="Choose a variable",
choice=list("Sepal.Length"=1, "Sepal.Width"=2, "Petal.Length"=3, "Petal.Width"=4, "Species"=5), selectize=FALSE),
checkboxGroupInput(inputId ="independent",label = "Select independent variables", choices = names(iris)),
mainPanel(
verbatimTextOutput("sum"),
plotlyOutput('plot_id_in_ui ', height = "900px")
)
))
)
server<-function(input,output){
output$sum <- renderPrint({
summary(iris[, as.numeric(input$var)])
})
output$plot_id_in_ui <- renderplot( { "DON'T KNOW HOW TO WRITE THIS PART"
pairplot(iris, varnames, type = "both", penalty.par.val = "lambda.1se",
nvals = c(20, 20), pred.type = "response") } )
})
shinyApp(ui, server)
【问题讨论】:
-
您的示例不起作用。仍然存在一些语法错误。
pairplot来自哪个包?
标签: r shiny shiny-server shiny-reactivity