【发布时间】:2017-02-13 07:54:55
【问题描述】:
require(shiny)
setwd("C://Users//Harshad//Desktop//Equiskill - BA")
cars <- read.table(file = "cars.csv", sep = ",", header = TRUE, quote="")
cars <- cars[,2:7]
ui <- fluidPage(
"Simple Linear Regression Modelling",
sidebarPanel(width = 2,
selectInput(inputId = "d_var",
label = "Select dependent variable:",
choices = c(names(cars))),
selectInput(inputId = "ind_var",
label = "Select independent variable:",
choices = c(names(cars)))
)
,
tableOutput("summary")
)
server <- function(input,output) {
model <- reactive (lm(input$d_var ~ input$ind_var, data=cars))
output$summary <- renderDataTable(
{ summary(model) }
)
}
shinyApp(ui <- ui, server <- server)
在 R 中执行代码时,我收到一个错误“'closure' 类型的对象不是子集”。请帮助。
在 R 中执行代码时,我收到一个错误“'closure' 类型的对象不是子集”。请帮助。
【问题讨论】:
-
summary(model())