@@ -651,16 +651,15 @@ updateSelectizeInput <- function(session, inputId, label = NULL, choices = NULL,
651
651
# other objects return arbitrary JSON {x: , y: , foo: , ...}
652
652
choices <- if (is.atomic(choices )) {
653
653
# fast path
654
- lab <- if (is.null(names(choices ))) {
655
- as.character(choices )
654
+ if (is.null(names(choices ))) {
655
+ lab <- as.character(choices )
656
656
} else {
657
657
lab <- names(choices )
658
658
# replace empty names like: choices = c(a = 1, 2)
659
659
# int this case: names(choices) = c("a", "")
660
660
# with replacement below choices will be: lab = c("a", "2")
661
661
empty_names_indices <- lab == " "
662
662
lab [empty_names_indices ] <- as.character(choices [empty_names_indices ])
663
- lab
664
663
}
665
664
# lab shold be lower-case for faster case-insensitive matching - grepl(... , fixed = TRUE)
666
665
lab <- tolower(lab )
@@ -689,26 +688,6 @@ selectizeJSON <- function(data, req) {
689
688
vfd <- query $ value # the value field name
690
689
sel <- attr(data , ' selected_value' , exact = TRUE )
691
690
692
- # convert a single vector to a data frame so it returns {label: , value: }
693
- # later in JSON; other objects return arbitrary JSON {x: , y: , foo: , ...}
694
- data <- if (is.atomic(data )) {
695
-
696
- if (is.null(names(data ))) {
697
- lab <- as.character(data )
698
- } else {
699
- lab <- names(data )
700
- # replace empty names like: data = c(a = 1, 2)
701
- # in this case: names(data) = c("a", "")
702
- # with replacement below choices will be: lab = c("a", "2")
703
- empty_names_indices <- lab == " "
704
- lab [empty_names_indices ] <- as.character(data [empty_names_indices ])
705
- }
706
-
707
- data.frame (label = lab , value = data ,
708
- stringsAsFactors = FALSE )
709
- } else {
710
- as.data.frame(data , stringsAsFactors = FALSE )
711
- }
712
691
# start searching for keywords in all specified columns
713
692
idx <- logical (nrow(data ))
714
693
if (length(key )) {
0 commit comments