【发布时间】:2018-07-22 20:43:28
【问题描述】:
R-package summarytools 中的 descr() 函数为 R 中的数值数据生成常见的集中趋势统计和离散度量。
当我在 Shiny 应用程序 中使用 descr() 和 by() 时,数据中包含的变量(特征)的名称会消失并且不显示。而是将名称替换为 Var1、Var2、Var3 等。
我真的不明白为什么当我在 Shiny 应用程序中实现这些代码时名称会消失(见下文)。 有什么想法吗?
# Install packages
source("https://bioconductor.org/biocLite.R")
biocLite("ALL")
biocLite("Biobase")
install.packages('devtools')
devtools::install_github('dcomtois/summarytools')
# Load packages
library(summarytools)
library(Biobase)
library(ALL)
# Shiny Server
server <- function(input, output, session) {
output$summaryTable <- renderUI({
#-- Load the ALL data
data(ALL)
#-- Subset
eset_object <- ALL [1:3,] # choose only 3 variables
#-- The group of interest
eset_groups <-"BT"
# print(rownames (eset_object)) # print variable names
ALL_stats_by_BT <- by(data = as.data.frame(t(exprs(eset_object))),
INDICES = (pData(eset_object)[,eset_groups]),
FUN = descr, stats ="all",
transpose = TRUE)
view(ALL_stats_by_BT,
method = 'render',
omit.headings = FALSE,
bootstrap.css = FALSE)
})
}
# Shiny UI
ui <- fluidPage(theme = "dfSummary.css",
fluidRow(
uiOutput("summaryTable")
)
)
# Lauch
shinyApp(ui, server)
【问题讨论】:
标签: r shiny summarytools