From 7465005c33b124998f420fb87708c360e04a0e6c Mon Sep 17 00:00:00 2001 From: Dony Unardi Date: Tue, 9 May 2023 07:30:27 -0700 Subject: [PATCH] fix label issue in FilterStateChoices (#272) Fixes #271 --- R/FilterStateChoices.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/FilterStateChoices.R b/R/FilterStateChoices.R index bef2afadc..9676b83ef 100644 --- a/R/FilterStateChoices.R +++ b/R/FilterStateChoices.R @@ -149,11 +149,13 @@ ChoicesFilterState <- R6::R6Class( # nolint ) x_factor <- if (!is.factor(x)) { - factor(as.character(x), levels = as.character(sort(unique(x)))) + structure( + factor(as.character(x), levels = as.character(sort(unique(x)))), + label = attr(x, "label") + ) } else { x } - x_factor <- droplevels(x_factor) args <- list( x = x_factor,