从列表中删除c和“ \”

时间:2018-07-09 13:45:14

标签: shiny

这是下面程序的输出。我得到我想要的;列表的列表,但是,我不明白为什么(c)中包含了列表,并且列表的元素在引号之间以反斜杠开头和结尾。 IDE中的输出消除了“反斜杠”,但是反斜杠不会出现在此编辑器中-也许您可以在RStudio中重新导入它们。如何消除这些字符-c(“ backwrads slash”)-?例如:

a = list()
b = anyvalue
a <- appemd(a, list(b))

将产生[1]“ c(” a“,” \ b“)”。如何从列表列表中消除这些字符?

谢谢

[1] "c("150413_JF_GPeps_SIDtarg_GPstdMix_Tryp_2runs_v3_PSMs.txt", "160824_JF_udep_tryp_Hi_SIDdda_FULL_NewParse-(05)_PSMs.txt") 3"
[2] "c("160824_JF_udep_tryp_Hi_SIDdda_FULL_NewParse-(05)_PSMs.txt", "JF_160426_Dep2Plas_ctryp_Gpep_SIDtargFULL__PSMs.txt") 3"
[3] "c("160824_JF_udep_tryp_Hi_SIDdda_FULL_NewParse-(05)_PSMs.txt", "JF_160426_Dep2Plas_ctryp_Gpep_SIDtargFULL__PSMs.txt") 3"

ui <- fluidPage(
   headerPanel("Test"),

 #textInput('txt','','Text'),
 selectInput("filescombine",label = h5(strong("PLEASE CHOSE FILES TO COMBINE. To undo selection select the selected file again and press the delete key on your keyboard.
                                               If you wish to make more 

sets, PLEASE PRESS ADD BUTTON AND CHOSE FILES TO COMBINE")),c(Choose='', list.files("~/Development/fileTest/GLYCOUNT/DATA")), multiple=TRUE, selectize=TRUE),
 actionButton('add','add'),
 verbatimTextOutput("list")
)  

 server <- function(input, output, session){
   myValues <- reactiveValues(List = list())
  observe({
     if(input$add > 0){
       #myValues$List <- c(isolate(myValues$List), isolate(list(input$txt)))
       myValues$List <- c(isolate(myValues$List), isolate(list(input$filescombine)))
    }
  })
   output$list<-renderPrint({
     myValues$List
     result <- receivelist(myValues$List)
     value <- paste(result$x, result$L)
     value
   })

 }

 receivelist <- function(myList){
   x <- list()
   x <- append(x, myList)
   L <- length(x)
   #print(paste(x, length(x)))
   list(x = x, L = L)

 }

 shinyApp(ui = ui, server = server)

0 个答案:

没有答案