juliasilge / widyr

Widen, process, and re-tidy a dataset
http://juliasilge.github.io/widyr/
Other
327 stars 29 forks source link

Allow seriation of columns based on their wide form #4

Open dgrtwo opened 8 years ago

dgrtwo commented 8 years ago

Wrap the seriation package, to order one or two columns based on their clustering.

An example with unvotes data would be something like:

library(unvotes)
un_votes_seriated <- seriate(un_votes, country, rcid, vote)

This should turn the country and rcid columns into ordered factors based on the clustering of the country x rcid matrix. This would be useful, for example, to feed into ggplot2 with geom_tile.

This will probably involve a new adverb that involves manipulating a data frame based on its wide form, but (unlike widely and squarely) while keeping its shape. (statically is closest but isn't quite right).