ropensci / visdat

Preliminary Exploratory Visualisation of Data
https://docs.ropensci.org/visdat/
Other
450 stars 47 forks source link

vis_dat do not render empty lists as missing values within list columns #136

Closed cregouby closed 2 years ago

cregouby commented 2 years ago

Missing values in list columns are not shown missing in vis_dat

ReprEx

in the example dataset starwars, two list columns vehicles and starship contains a lot of missing values. Those missing values can be identified as character vectors of length 0 as follow This is very misleading in the vis_dat output visualization as it let you think those columns are complete.

library(dplyr, warn.conflicts = FALSE)
data("starwars")
head(starwars %>% select(vehicles, starships))
#> # A tibble: 6 × 2
#>   vehicles  starships
#>   <list>    <list>   
#> 1 <chr [2]> <chr [2]>
#> 2 <chr [0]> <chr [0]>
#> 3 <chr [0]> <chr [0]>
#> 4 <chr [0]> <chr [1]>
#> 5 <chr [1]> <chr [0]>
#> 6 <chr [0]> <chr [0]>

Created on 2021-09-11 by the reprex package (v2.0.1)

Current behaviour

library(visdat)
data("starwars",package = "dplyr")
vis_dat(starwars)

Created on 2021-09-11 by the reprex package (v2.0.1)

Expected behavior

library(visdat)
data("starwars",package = "dplyr")
vis_dat(starwars)

Created on 2021-09-11 by the reprex package (v2.0.1)