2016-08-23 71 views
2

我有這個應用程序正在4Gb RAM Shiny服務器上工作,但我也上傳到shinyapps.io(這是限於1GB內存)。問題在於其中一個選項卡總是會導致應用程序崩潰。事實上,這個標籤需要超過1Gb的RAM才能運行。所以我想知道是否有辦法讓應用程序喜歡它,並且所有選項卡對於用戶都是可見的(所以他知道應用程序可以對一個好的服務器執行什麼操作)。但也使其中一個標籤無法訪問。我的意思是用戶可以瀏覽所有選項卡,除非他在特定的崩潰選項卡上進行搜索時,會出現一些沒有用戶彈出的入口標誌。所以他不能點擊這個標籤,但他仍然看到它。製作一個標籤可見,但無法在R閃亮的應用程序

Thx,我認爲這是不可能的,但我們永遠不知道!也許用一些Javascript或CSS!

像這樣的東西與我的所有標籤:

enter image description here

回答

0

有點技巧,但工作示例

想法

1)添加ID的所有選項卡和HREF中(爲它創建功能)

2)禁用它

上actionbutton

禁用選項卡表(我不知道你是怎麼wnat估計「好服務器」選項卡,從而禁止manualy)

library(shiny) 
library(shinyjs) 


server<-shinyServer(function(input, output) { 
    observeEvent(input$disable,{ 
    disable("Table") 
    disable("Table_") 
    }) 

}) 
add_id=function(ss){ 

    ss$children[[1]]$children=lapply(ss$children[[1]]$children,function(i){ 
    i$attribs=list(id=i$children[[1]]$attribs["data-value"][[1]]) 
    i$children[[1]]$attribs=c(i$children[[1]]$attribs,id=paste0(i$children[[1]]$attribs["data-value"][[1]],"_")) 
    return(i) 
    }) 
    return(ss) 
} 


ui<-shinyUI(fluidPage(
    useShinyjs(), 
    actionButton("disable","disable"), 
    add_id(tabsetPanel(
     tabPanel("Plot", h1("1")), 
     tabPanel("Summary", h1("2")), 
     tabPanel("Table", h1("3")) 
    )) 

)) 
runApp(list(ui=ui,server=server)) 
相關問題