自从过去一个月以来,我一直在Google Chrome
测试我的R闪亮应用程序,直到今天早上一直运行良好。每当我尝试部署它 - 在本地或使用shinyapps.io服务器 - 几秒后它就会没有响应,并建议我等待或终止该页面。我在本地以及通过shinyapps.io在Safari
中部署了相同的应用程序,并且它工作得很好。
以下是指向具有类似行为的子集的链接 - https://rathik.shinyapps.io/data_marislab/
更新 这是我的代码片段,我突出显示了最有可能导致问题的部分 - 如果有人可以帮我找到替代品:
# ui.R
tabItem(tabName = "clge",
fluidRow(
box(selectInput(inputId = "clgeselectInput1", label = "Select dataset",
choices = c('Dataset1'='dataset1',
'Dataset2'='dataset2')),
actionButton(inputId = "clgesubmit1", label = "Load dataset"), width = 4, background = "navy"),
box(selectInput(inputId = "clgeselectInput2", label = "Select Gene", choices = "none"), width = 3, background = "navy"),
box(checkboxInput(inputId = "clgecheckboxInput1", label = "Log", value = TRUE), width = 2, background = "navy"),
box(selectInput(inputId = "clgeselectInput3", label = "Sort by", choices = c('Variable', 'Value')), width = 3, background = 'navy')
),
fluidRow(column(5, actionButton(inputId = 'clgesubmit2', label = "Get Expression Plot"))), br(), br(),
plotlyOutput(outputId = "clgeplot1", width = 800, height = 800)
)
# server.R
# select dataset from clgeselectInput1, when clgesubmit1 is clicked, a second selectInput clgeselectInput2 is updated with the rownames of selected dataset
observe({
if(input$clgesubmit1 == 0){
return()
}
# this could be the problem
##############################################
dat <- as.character(input$clgeselectInput1)
dat <- get(load(paste0('data/',dat,'.RData')))
num <- rownames(dat)
updateSelectInput(session = session, inputId = "clgeselectInput2", choices = num)
##############################################
# when I replace the above snippet with the below, it works fine!
updateSelectInput(session = session, inputId = "clgeselectInput2", choices = c('MYC','MYCN'))
})
# after clgeselectInput2 is updated with rownames, you can select and click on clgesubmit2 to output expression plot for selected gene.
output$clgeplot1 <- renderPlotly({
if(input$clgesubmit2 == 0){
return()
}
isolate({
dat <- as.character(input$clgeselectInput1)
dat <- get(load(paste0('data/',dat,'.RData')))
gene1 <- as.character(input$clgeselectInput2)
logvalue <- input$clgecheckboxInput1
sortby <- input$clgeselectInput3
plotGeneBar(dat = dat, gene1 = gene1, log = logvalue, sortby)
})
})
更新2:
还尝试更改此类观察事件,但仍无法正常工作:
# reactive function
clge <- reactive({
dat <- as.character(input$clgeselectInput1)
dat <- get(load(paste0('data/',dat,'.RData')))
num <- as.character(rownames(dat))
})
# output expression plot for selected gene
observe({
if(input$clgesubmit1 == 0){
return()
}
isolate({
updateSelectInput(session = session, inputId = "clgeselectInput2", choices = clge())
})
})
正如其他地方所建议的,我也尝试清除我的chrome缓存。在这种情况下我还能尝试什么呢?
谢谢!