【发布时间】:2018-06-14 22:36:39
【问题描述】:
我希望基于客户可以选择的selectInput(),将所选变量的摘要打印在一个框中。我的 ui.R 代码是:
box(
title = "Informed Investor",
status = "primary",
solidHeader = TRUE,
width = 6,
selectInput("informedDset", label="Select Category", choices = list("Informed Full" = "InformedFull", "Informed Fact" = "InformedFact", "Informed Fact Positive" = "InformedFact.Pos", "Informed Fact Negative" = "InformedFact.Neg", "Informed Emotions" = "InformedEmotions", "Informed Emotions Fact" = "InformedEmotionsFact"), selected = "Informed Full")
),
box(
title = "Data Table",
status = "warning",
solidHeader = TRUE,
width = 6,
height = 142,
verbatimTextOutput("summaryDset")
)
还有我的 server.R 代码:
output$summaryDset <- renderPrint({
summary(input$informedDset)
})
【问题讨论】:
-
选择只是表示,应该用于检索数据集的一部分,因此对它们进行总结没有意义。查看here了解更多详情。
-
什么样的总结?为什么你的方法不起作用?怎么了?
-
@A.Suliman 谢谢!但是你知道我该如何解决我的问题吗?
-
@phalteman 我得到了这个:
Length Class Mode 1 character character -
"InformedFull", .... 等应该代表可以汇总的数据或变量。由于这些只是名称,请在 R 中尝试
summary("InformedFull")。
标签: r variables printing shiny summary