r - R中的selectizeInput闪亮
问题描述
我做 R 闪亮的项目,在 ui.RI 有这个代码:
用户界面
tabPanel("Ctree", fluidPage(
sidebarLayout(
selectizeInput("ctreeinput","Zvolte atributy k cielovemu atributu LoanAmount",choices=colnames(stats_people),multiple=TRUE),
mainPanel(tableOutput("ctree1"))
)
))
服务器.R
output$ctree1<- renderTable({
set.seed(123)
library(party)
myFormula = LoanAmount_1 ~ input$ctreeinput
ctree = ctree(myFormula, data=train.ctree)
table(predict(ctree), train.ctree$LoanAmount_1)
ctreePred = predict(ctree, newdata = test.ctree)
table(ctreePred, test.ctree$LoanAmount_1)
})
在 server.RI 中有 myFormula,我想在其中创建如下内容:
myFormula = LoanAmount ~ ApplicantIncome+CoapplicantIncome+Dependents+Gender+Married
...但它必须由用户创建。我想使用选择输入。这个解决方案,我在这里粘贴的,它不起作用,RStudio 说,错误:找不到对象'输入'。我应该怎么做才能处理我的代码?谢谢!
解决方案
在 server.R 中,在定义 之前myFormula
,您需要定义一个名为 的对象(例如,数据框)input
以及一个名为 的子对象(例如,列)ctreeinput
。
推荐阅读
- mysql - 无法在 FK 列中插入 NULL 值
- python - _imagingft c 模块未安装 amazon linux elasticbeanstalk
- javascript - 使用 JavaScript 在 Selenium 中执行 JavaScript 代码
- swift - Xcode 13.0 中的模棱两可的布局警告
- php - 如何在 laravel 中显示旧的 datetime-local 值?
- sql - 在主表中生成虚拟列
- mysql - 如何为重新测试记录创建模式?
- python - 在 PyTorch 中计算加权平均值
- c++ - OpenCV C++ 中的位移
- javascript - Mongoose Model.Create 和 Model.Update 另一个