2016-11-21 5 views
0

selectInput(....multiple=TRUE)을 사용하여 사용자 선택을위한 입력 목록을 만들고 있는데, 여기에서 사용자는 여러 옵션을 선택할 수 있지만 사용자가 내 서버에서 어떤 옵션을 선택했는지 확인/읽지 못합니다.Shiny 서버에서 다중 선택 확인

누구든지 성공적으로 시도했다면 공유 할 수 있습니까? 예를 들어

- 디렉토리를 들어 파일을 folowing있다 -

/User/DE/AvsB.de.txt- 

Feature.ID Read.Count.All Read.Count.A Read.Count.B FC 
ENSG00000121898 3367.375403 6734.750807 0 0 
ENSG00000104435 2161.235573 4322.471145 0 0 
ENSG00000229847 2111.660196 4223.320392 0 0 
ENSG00000046889 1302.993351 2605.986702 0 0 

/User/DE/CvsD.de.txt - 내 코드가 입력에서 파일 이름을 보여줍니다

Feature.ID Read.Count.All Read.Count.C Read.Count.D FC 
ENSG00000248329 373.0309339 746.0618679 0 0 
ENSG00000144115 352.3786793 704.7573586 0 0 
ENSG00000158528 351.6252529 703.2505057 0 0 
ENSG00000189058 350.5375828 701.0751656 0 0 


library(gtools) 
D_files <- list.files(path = "/User/DE/",pattern = "*.de.txt" ,recursive = F, full.names = T) 
D_filename <- vector() 
for(i in 1:length(D_files)){ 
    D_filename[i] <- D_files[i] 
} 
D_filename <- unlist(strapplyc(D_filename, "/User/DE/(.*).de.txt")) 
names(D_files)<- D_filename 


    ui <- fluidPage(

    mainPanel(

     uiOutput("Quad_plot_comparison"), 
     HTML("<br><br>"), 
     br() 
) 
) 

    server <- function(input, output) { 
    output$Quad_plot_comparison <- renderUI({ 
     selectInput(inputId = "vars",label = h3("Select comparison"), choices = mixedsort(D_files), multiple = T) 
    }) 
    } 

    shinyApp(ui, server) 

상자,하지만 다음을 수행해야합니다.

1- Select multiple file names from the box 
2- Read user input (variables in the input box) 
3- Read the files corresponding to these user input into a data frame 

나는 두 번째 단계도 얻을 수 없습니다. o 일, 어떤 도움이 작동합니다! 감사합니다.

+0

, 재현 예를 – HubertL

+0

안녕 @HubertL을 게시하시기 바랍니다, 감사합니다! 방금 내 코드 – AnkP

+0

을 게시했습니다. 재현하려면 파일을 재생할 필요가 없습니다. 쉽게 문제를 재현 할 수 있도록 작은 데이터 세트를 만드십시오. (복사하여 붙여 넣기하여보고 싶습니다.) – HubertL

답변

0

selectInput에 여러 선택을 사용하는 방법에 대한 작은 예입니다. 당신은 reactive에서 파일을 읽고 시나리오 당신에 적응 할 수

그것은 확실히 가능
library(shiny) 
shinyApp(ui=fluidPage(selectInput("select", "choose", c(1,2,3), multiple = TRUE), 
         textOutput("selected", inline=TRUE)), 
     server=function(input, output){ 
         selected <- reactive(ifelse(is.null(input$select), "nothing", 
                paste(input$select, collapse=","))) 
         output$selected <- renderText(paste("Selected=",selected())) 
         })