esquisse icon indicating copy to clipboard operation
esquisse copied to clipboard

One categorical variable is missing from the Data tab

Open jmouchnino opened this issue 2 years ago • 5 comments

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()

image Capture d’écran 2022-07-24 210617

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.

jmouchnino avatar Jul 24 '22 18:07 jmouchnino

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?

pvictor avatar Jul 25 '22 09:07 pvictor

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)

jmouchnino avatar Jul 28 '22 16:07 jmouchnino

Ah yes, sorry. If there are more than 50 unique value, the filter isn't generated. Maybe we should reconsider that rule.

pvictor avatar Jul 29 '22 10:07 pvictor

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

emilopezcano avatar Aug 15 '23 10:08 emilopezcano

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)

bblank70 avatar Nov 08 '23 16:11 bblank70