반짝이는 서버를 사용하여 서버에 하나의 반짝이는 응용 프로그램을 배포했습니다. 샘플 예는 다음과 같습니다 :모든 패키지가로드 될 때까지 메시지 표시
ui.R
#library(shinyjs)
library(shiny)
#filenames <- list.files(path = "data",pattern="\\.csv$")
#names(filenames) <- gsub(pattern = "\\.csv$", "", filenames)
shinyUI(fluidPage(
titlePanel(
headerPanel(
h3("Testing....",
align="center", style="bold")
)
),
br(),
br(),
#useShinyjs(), ## initialize shinyjs to reset input files.
sidebarLayout(
sidebarPanel(
h5("Upload Data Files",style="bold"),
fileInput("files",
"Choose CSV/txt processed files or raw files",
multiple = "TRUE",
accept=c('text/csv',
'text/comma-separated-values,
text/plain', '.csv','.cel','.TXT','.txt')),
#selectInput('dataset',"Choose platform annotation file", c("Please select a file" ='',filenames)),
fluidRow(
column(5,
radioButtons("radio", label = h5("Data uploaded"),
choices = list("Affymetrix" = 1, "Codelink" = 2,
"Illumina" = 3),selected = NULL)
)
),
fluidRow(
column(10,
h5("Differential Expression Call", style = "bold"),
checkboxInput("checkbox",
label = "Differential Expression", value = FALSE))),
br(),
uiOutput('AnnotationFile')),
mainPanel(
tabsetPanel(id = "MamgedTabs",
tabPanel("Source-data", dataTableOutput("sourced")),
tabPanel("Annotation-data",dataTableOutput("annotation"))
)
)
)
)
)
server.R
#library(gcrma)
#library(hgu133a.db)
#library(hgu133acdf)
#library(hgu133plus2.db)
#library(hgu133plus2cdf)
#library(hgu133a2frmavecs)
#library(hgu133b.db)
#library(hgu133bcdf)
#library(hgu219.db)
#library(hgu219cdf)
#library(hgu95a.db)
#library(hgu95acdf)
#library(org.Hs.eg.db)
#library(hgu133a2.db)
#library(hgu133a2cdf)
#library(hgu95av2.db)
#library(hgu95av2cdf)
#library(hgu133plus2cdf)
#library(affyPLM)
##library(makecdfenv)
#library(parallel)
#library(base)
#library(S4Vectors)
#library(IRanges)
#library(stats4)
#library(BiocInstaller)
#library(Biobase)
#library(BiocGenerics)
#library(BiocParallel)
#library(biomaRt)
#library(Biostrings)
#library(preprocessCore)
#library(affyio)
#library(zlibbioc)
#library(graphics)
#library(grDevices)
#library(methods)
#library(genefilter)
#library(stats)
#library(AnnotationDbi)
#library(utils)
## Defining the size of file to be accepted. Here it can accept any size.
options(shiny.maxRequestSize= -1)
shinyServer(function(input, output,session) {
filenames <- list.files(path = "data", pattern="\\.txt$")
names(filenames) <- gsub(pattern = "\\.txt$", "", filenames)
## Dropdown box for chosing and loading annotation file
output$AnnotationFile = renderUI({
if(!input$checkbox | (input$checkbox == T && input$radio != 2)){
wellPanel(
h5("Upload Annotation File"),
selectInput('dataset', "Choose platform annotation file",
c("Please select a file" = '', filenames), multiple = TRUE))
}
})
})
당신이 server.R
에서 보듯이, 내가로드 할 많은 패키지가 필요, 그것은 약간의 시간이 걸립니다. 아래의 코드
output$AnnotationFile = renderUI({
if(!input$checkbox | (input$checkbox == T && input$radio != 2)){
wellPanel(
h5("Upload Annotation File"),
selectInput('dataset', "Choose platform annotation file",
c("Please select a file" = '', filenames), multiple = TRUE))
}
})
는 숨기기 뭔가입니다 보여주는 것입니다 시간이 패키지를로드 할 가지고 있기 때문에, 표시되기까지 다소 시간이 걸리지 만, 때로는 전혀 표시되지 않습니다.
1) 내 응용 프로그램은 로컬에서 올바르게 작동하지만 서버에 배포 할 때이 동작을 보여줍니다. 어떤 이유?
2) 모든 패키지를로드 할 때까지 응용 프로그램이 준비 중이라는 메시지를 주 패널에 표시하려면 어떻게해야합니까?
편집 : 나는 shinyServer() 내부에 메시지를 표시 할 수 있습니다,하지만 그건 (또 다시 모든 패키지를로드합니다) 그러나 내가 표시하고 시작시 모든 패키지를로드 할 각 세션입니다 신청. 즉, shinyServer() 외부에서 진행 메시지를 표시하는 방법
'renderPrint'는 여러분과 여러분의 메시지를 표시하기 위해'print' 메소드를 사용하는 데 유용 할 수 있습니다. –
'shinysky' 패키지에서'busyIndicator'를 사용할 수 있습니다. 더 자세한 정보는 다음을 참고하십시오 : [link] (https://github.com/AnalytixWare/ShinySky) – SBista