ropensci / visdat

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

add a flip = TRUE argument to vis_* and friends #35

Closed njtierney closed 7 years ago

njtierney commented 7 years ago

This is so vis_dat and vis_miss etc look more like a dataframe, where the axis labels are on the top, and the row numbers go from 1 - the total number.

seasmith commented 7 years ago

ggplot2::scale_y_reverse() seems to take care of this for both vis_dat() and vis_miss().

# i.e.
airquality %>%
  vis_miss() +
  ggplot2::scale_y_reverse()
njtierney commented 7 years ago

Thanks for that, I also wanted to flip the axis on to the top so it more closely resembles a dataframe.

Here's the new options

library(visdat)

tibble::as_tibble(airquality)
#> # A tibble: 153 × 6
#>    Ozone Solar.R  Wind  Temp Month   Day
#>    <int>   <int> <dbl> <int> <int> <int>
#> 1     41     190   7.4    67     5     1
#> 2     36     118   8.0    72     5     2
#> 3     12     149  12.6    74     5     3
#> 4     18     313  11.5    62     5     4
#> 5     NA      NA  14.3    56     5     5
#> 6     28      NA  14.9    66     5     6
#> 7     23     299   8.6    65     5     7
#> 8     19      99  13.8    59     5     8
#> 9      8      19  20.1    61     5     9
#> 10    NA     194   8.6    69     5    10
#> # ... with 143 more rows

vis_dat(airquality)


vis_dat(airquality,flip = TRUE)


vis_miss(airquality)


vis_miss(airquality,flip = TRUE)