2017-11-06 2 views
0

나는 SHINY 응용 프로그램에서 작업 중이며 100 개의 다른 변수와 함께 제공되는 드롭 다운 메뉴를 사용하고 있습니다. 나는 이들 중 일부만 보여주고 싶다. 나는 data.frame을 단축 할 수 있었지만, 다른 이유 때문에 오랫동안 기다려야합니다. 어떤 아이디어?드롭 다운 목록에 표시된 변수를 사용자 정의하는 방법

도움 주셔서 감사합니다. 반응성에

output$xvar <- renderUI(selectInput('xvar',label='I want to show only certain variables here', choices = names(df),selected = names(df)[1])) 

답변

1

랩 부분 집합을하고 그냥 렌더링 :

library(shiny) 

ui <- fluidPage(
    uiOutput("xvar") 
) 

df <- 1:100 
server <- function(input, output, session) { 

    dfsubset <- reactive({ 
    df[1:10] 
    }) 

    output$xvar <- renderUI(selectInput('xvar',label='I want to show only certain variables here', 
             choices = dfsubset(),selected = dfsubset())) 
} 

shinyApp(ui,server) 

내가 server.R에있는 것입니다