1
다음과 같이 내가 명명 된 목록을 사용하여 명명 된 목록 정렬 : 나는 이름을 기준으로 목록을 주문하려고,이 잘 작동actionButton 반짝
vegshop <- list(
"FRUITS" = c("MANGO", "JACKFRUIT", "BANANA"),
'VEGETABLES' = c("OKRA", "BEANS", "CABBAGE")
)
합니다.
the condition has `length > 1` and only the first element will be used
또는
Warning: Error in order: unimplemented type 'list' in 'orderVector1'
실행 가능한 예는 다음과 같다 : 내가 actionButton()
을 사용하여이 작업을 수행 할 때
vegshop[order(names(vegshop), decreasing = F)]
는 그러나, 나는 다음과 같은 오류를 얻고있다
vegshop <- list(
"FRUITS" = c("MANGO", "JACKFRUIT", "BANANA"),
'VEGETABLES' = c("OKRA", "BEANS", "CABBAGE")
)
grocer <- list(
"GROCERY" = c("CEREALS", "PULSES", "TOILETRIES"),
"CLEANERS" = c("DETERGENTS", "FLOOR CLEANERS", "WIPES")
)
library(shiny)
ui <- shinyUI(
fluidPage(
actionButton(style = "font-size: 10px;",inputId = "a2z", label = "Sort-A-Z", icon = icon("sort-alpha-asc")),
radioButtons(inputId = "shopsel", label = "SELECT SHOP", choices = c("SHOPS","SUPERMARKETS"), selected = "SHOPS", inline = TRUE),
uiOutput("shoplist")))
server <- function(session,input, output) {
output$shoplist <- renderUI({
if(input$shopsel == "SHOPS") {
selectInput(inputId = "vegShopList", label = "SHOPLIST", choices = vegshop, selected = c('MANGO', 'JACKFRUIT', 'BANANA'), multiple = TRUE, selectize = FALSE)
} else if(input$shopsel == "SUPERMARKETS") {
selectInput(inputId = "smList", label = "SUPERMARKET", choices = grocer, selected = c('CEREALS', 'PULSES', 'TOILETRIES'), multiple = TRUE, selectize = FALSE)
}
})
observeEvent(input$a2z, {
if(input$shopsel == "SHOPS") {
updateSelectInput(session, inputId = "vegShopList", choices = vegshop[order(vegshop), decreasing = F], selected = NULL)
} else if(input$shopsel == "SUPERMARKETS") {
updateSelectInput(session, inputId = "smList", choices = grocer[order(grocer), decreasing = F], selected = NULL)
}
})
}
shinyApp(ui = ui, server = server)
어떻게 얻을 수 있습니까? 목록은 actionButton()
을 사용하여 이름순으로 정렬됩니다.
감사 : 같은 아마 다음과 같은 반짝 코드에 대한 보유
당신. : -) .... – Apricot
그것이 당신을 위해 작동한다면 나는 upvote 주셔서 감사합니다 :) – BigDataScientist