R Shinny:Google Chrome对Shinny应用程序无响应
在过去的一个月里,我一直在谷歌Chrome上测试我的Rshinny应用程序,直到今天早上它都运行良好。每当我试图在本地或使用shinyapps.io服务器部署它时,几秒钟后它就会无响应,并建议我等待或终止页面。我在本地以及Safari中通过shinyapps.io部署了相同的应用程序,效果非常好 下面是指向具有类似行为的子集的链接- 更新: 下面是我的一段代码,我强调了最有可能导致问题的部分-如果有人能帮我找到替代方案:R Shinny:Google Chrome对Shinny应用程序无响应,r,macos,google-chrome,shiny,R,Macos,Google Chrome,Shiny,在过去的一个月里,我一直在谷歌Chrome上测试我的Rshinny应用程序,直到今天早上它都运行良好。每当我试图在本地或使用shinyapps.io服务器部署它时,几秒钟后它就会无响应,并建议我等待或终止页面。我在本地以及Safari中通过shinyapps.io部署了相同的应用程序,效果非常好 下面是指向具有类似行为的子集的链接- 更新: 下面是我的一段代码,我强调了最有可能导致问题的部分-如果有人能帮我找到替代方案: # ui.R tabItem(tabName = "clge",
# 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缓存。在这种情况下,我还能尝试什么
谢谢 对于meLike部署我的应用程序,工作正常吗?所以有一个叫做可视化工具>基因表达的标签。当您单击“选择数据集>加载数据集”时,几秒钟后,“选择基因”下拉列表将自动更新为数据集中的基因列表。这就是chrome在一段时间后失去响应的原因。然而,我在Safari上也做了同样的事情。试着找出昨天和今天之间发生了什么变化,例如,chrome版本,你更新过的任何R包,你更新过的任何javascript库。我检查过了。没有更新。你能重现这个问题并在这里发布一个小例子吗