我有一个约束,根据这些约束,我正在为客户分配细分。但我想更改ui中的约束并立即在后台计算段。所以这是我的代码。
shinyServer(function(input, output) {
Customer$Segment <- reactive({
onetimer <- input$onetimer
firstcons <- input$firstcons
secondcons <- input$secondcons
rental1 <- input$rental1
rental2 <- input$rental2
ifelse(Customer$Rentals < rental1 & Customer$TotalPayment <= firstcons, "One-Timer",
......)
output$result <- renderText({Customer$Segment})
听http://127.0.0.1:6199警告:rep中出错:尝试复制'closure'类型的对象49:$
如何用闪亮的方式编辑我的数据?
您正在创建一个反应变量,您必须以不同的方式解决它。但是,请分享更多代码,因为您的代码似乎有多个问题。除了变量寻址之外,renderText也不适用于列表。
# create
Customer <- reactive({
# do something
# return list
return(list(Segment=list(onetimer=onetimer)))
})
# output
output$result <- renderText({
paste(unlist(Customer()$Segment),collapse="\n")
})