【问题标题】:Shiny Editing Data闪亮的编辑数据
【发布时间】:2019-08-01 12:03:00
【问题描述】:

我有一个限制条件,根据该限制条件,我将细分市场分配给客户。但我想更改 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 警告:代表错误:尝试 复制“闭包”类型的对象 49: $

如何使用闪亮编辑我的数据?

【问题讨论】:

  • 你能分享更多代码吗?

标签: r user-interface server shiny edit


【解决方案1】:

您正在创建一个反应变量,您必须以不同的方式处理它。但是,请分享更多代码,因为您的代码似乎有不止一个问题。除了变量寻址,renderText 不能用于列表。

# create 
Customer <- reactive({
  # do something

  # return list
  return(list(Segment=list(onetimer=onetimer))) 
})

# output
output$result <- renderText({
  paste(unlist(Customer()$Segment),collapse="\n")
})

【讨论】:

    猜你喜欢
    • 2015-05-22
    • 2019-10-25
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 2020-11-05
    • 1970-01-01
    • 1970-01-01
    • 2020-02-23
    相关资源
    最近更新 更多