esquisse
esquisse copied to clipboard
One categorical variable is missing from the Data tab
I use this data
library(dplyr)
tuesdata <- tidytuesdayR::tt_load(2022, week = 29)
technology <- tuesdata$technology %>% select(variable, iso3c, year, value) %>% dplyr::slice_sample(n = 30000)
esquisse::esquisser()
Why are the categorical variables missing from the Data tab ? I'm sure that once it was possible to filter the categorical variables in the app.
Variables that contain only unique values are automatically discarded. The idea behind this is that it is not interesting to visually represent a single line of a data.frame. Does this bother your usage?
The iso3c
variable doesn't contain unique values only
set.seed(7)
tuesdata <- tidytuesdayR::tt_load(2022, week = 29)
technology <- tuesdata$technology %>% select(variable, iso3c, year, value) %>% dplyr::slice_sample(n = 30000)
technology$iso3c %>% table() %>% head
# ABW AFG AGO ALB AND ANT
# 35 96 129 155 22 3
esquisse::esquisser(technology)
Ah yes, sorry. If there are more than 50 unique value, the filter isn't generated. Maybe we should reconsider that rule.
I would suggest adding an argument to the esquise_server() function and modify the call to filter_data_server() in this line to allow customisation when adding esquisse to shiny apps:
https://github.com/emilopezcano/esquisse/blob/3dc09ef43e97a35292c209917ecf395aecfb5ead/R/module-controls.R#L293C15-L293C15
I will send a pull request for your review
It is a bit of a hacky fix, but you can edit the functionality of the drop_id function using trace(). drop_id() contains the fixed integer value of 50 that is referred to above. You should probably limit this to a reasonable value based on your distinct values you would expect.
trace(datamods::drop_id, edit=TRUE)