visdat icon indicating copy to clipboard operation
visdat copied to clipboard

Suggestion: vis_dat() allow setting an index variable

Open jzadra opened this issue 5 years ago • 2 comments

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.

jzadra avatar Nov 24 '18 20:11 jzadra

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

njtierney avatar Nov 28 '18 01:11 njtierney

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.

jzadra avatar Nov 28 '18 17:11 jzadra