ropensci / visdat

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

Suggestion: vis_dat() allow setting an index variable #105

Open jzadra opened 5 years ago

jzadra commented 5 years ago

It would be nice if vis_dat() had an option to select an index or grouping variable. Currently the y-axis is just straight observation index (row num).

For instance with time series data, perhaps the group could be set to the column that has a "year" value. Then ticks could be placed on the y axis for each year, or perhaps horizontal lines going across the entire plot. Same if you were combining multiple tables with bind_rows() and set an id variable - seeing where they were joined by setting the id as the group/index for vis_dat() would aid in seeing where discontinuities exist.

njtierney commented 5 years ago

Good idea, I like it! I think I discuss something similar in #91, but not quite. I'd like to explore this more.

jzadra commented 5 years ago

If what I understand from #91 is correct, then showing factor values for factor columns might be another way to go about this.

Two thoughts about this avenue though: 1) it would require converting things to factor first (for instance year, which should be stored as numeric) 2) it wouldn't create tick values on the y-axis

Another option - what if any column with less than x unique values gets treated like a factor (ie different colors for values), and the value of x is an argument.