我有一个从成绩开发的回归模型;我希望用户输入他们的成绩并获得他们预测的测试分数的95%CI。我的输出代码给出以下错误:
ERROR: [on_request_read] connection reset by peer
Warning: Error in eval: invalid 'envir' argument of type 'closure'
堆栈跟踪(最里面的第一个):
73: eval
72: model.frame.default
71: model.frame
70: predict.lm
69: renderTable [C:\Users\Mark\Documents\R\COMLEXPrediction/server.R#25]
68: func
67: output$values
1: shiny::runApp
这是UI代码:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Predict Your COMLEX Level 1 Score"),
sidebarPanel(
# Simple integer interval
sliderInput("integer", "Input your Psychiatry 1522 Grade:",
min=0, max=100, value=85),
# Simple integer interval
sliderInput("integer2", "Input your Pharmacology 1611 Grade:",
min=0, max=100, value=85),
# Decimal interval with step value
sliderInput("decimal", "Input your Year 1 GPA:",
min = 0.00, max = 4.00, value = 3.0, step= 0.01)
),
mainPanel(tableOutput("values"))
))
服务器代码:
library(shiny)
data <- read.csv('2015_CourseGradesandCOMLEXL1Disciplines_NoNames.csv')
comlex.lm <- lm(COMLEXL1_Total ~ PSYC1522_Total + Year1_GPA + PHAR1633_Total, data=data, na.action = "na.exclude")
# Define server logic for slider examples
shinyServer(function(input, output) {
# Reactive expression to compose a data frame containing all of
# the values
predictdata <- reactive({
# Compose data frame
data.frame(
Name = c("PSYC1522",
"PHAR1611",
"GPA"),
Value = as.character(c(input$integer,
input$integer2,
input$decimal)),
stringsAsFactors=FALSE)
})
# Show the values using an HTML table
output$values <- renderTable({
comlex.pred <- predict.lm(comlex.lm, data.frame)
output$regTab <- renderTable({
if(!is.null(input$independent)){
summary(runRegression())$coefficients
} else {
print(data.frame(Warning="Please select Model Parameters."))
}
})
})
})
我试过跟踪我的闭包,并将调用从值更改为表,但没有成功。任何帮助表示赞赏。