【发布时间】:2015-08-07 17:02:54
【问题描述】:
我想选择一个特征和模型(从侧边栏下拉菜单中),并能够将模型传递到一个特定的输出,我打印模型的摘要并以图形方式显示模型的拟合程度。我目前在 server.R 中有一个反应函数,它检查选择了哪个 input$model,然后拟合模型并返回它。当我尝试从 output$evaluation 调用这个反应函数时,我得到了错误。我不知道该怎么做。
# server.R
#...
fitter <- reactive({
df_clean <- dataset() # another reactive function that selects the dataset to be used
rownames(df_clean) <- df_clean$timestamp
df_clean$timestamp <- NULL
if (input$Model == 'Linear'){
fit <- lm(input$Response ~., data=df_clean)
}
#... more if statements checking for other model types
return(fit)
})
# Model Evaluation
output$Evaluation <- renderPrint({
summary(fitter())
})
【问题讨论】: