【发布时间】:2023-03-29 09:56:02
【问题描述】:
我正在尝试为 mtcars 数据集的每个 X 变量相对于 y 创建一个动态图。 基本上,我的 y 变量是“vs”列,其余的是我的 X 变量 但是,当我尝试运行该应用程序时,出现以下错误。有什么想法吗?
Warning: Error in xy.coords: 'x' and 'y' lengths differ
library(shiny)
library(shinydashboard)
data("mtcars")
y <- mtcars$vs
X <- mtcars[ , !(names(mtcars) %in% "vs")]
header_app <- dashboardHeader()
sidebar_app <- dashboardSidebar()
body_app <- dashboardBody(
fluidRow(
box(
selectInput("filter", "Correlation", choices = names(X)),
plotOutput("plot1", height = "250")
) #box
) #Fluid Row
)
ui <- dashboardPage(header = header_app, sidebar = sidebar_app, body = body_app)
server <- function(input,output){
output$plot1 <- renderPlot({plot(input$filter,y)})
}
shinyApp(ui,server)
【问题讨论】:
标签: r shiny shinydashboard