r - Sort factor using an other factor -
i use tutorial tu plot heatmap using ggplot2
http://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/
now i'd order vertical factor using onother factor same length.
strains x1 x2 x3 origin name 4 2 4 see
does have idea how work?
thanks
if have column in nba, instance nba$country
, can adjust ordering in original by
nba$name <- with(nba, reorder(name, country))
if have alternative annotation want order by, you'll need match in. instance if have player-country data.frame (pc), then
nba$name <- reorder(nba$name, pc$country[match(nba$name, pc$name)])
Comments
Post a Comment