I have a dataframe which in R looks somewhat like this.
set.seed(100)
df <- data.frame(ID = 1:10,
I.2011 = sample(1:3, rep = 1, 10),
I.2012 = sample(1:3, rep = 1, 10),
I.2013 = sample(1:3, rep = 1, 10),
I.2014 = sample(1:3, rep = 1, 10))
ID I.2011 I.2012 I.2013 I.2014
1 1 1 2 2 2
2 2 1 3 3 3
3 3 2 1 2 2
4 4 1 2 3 3
5 5 2 3 2 3
6 6 2 3 1 3
7 7 3 1 3 1
8 8 2 2 3 2
9 9 2 2 2 3
10 10 1 3 1 1
The data is longitudinal, and I am interested in people's transitions over time. Particularly important are the group of people who begin in 2011 in group 2, so perhaps in some visualisation the people who satisfy this criteria would have their trajectory in colour whereas all other trajectories would be in shades of grey.
I am wondering if anyone had a neat solution for visualising these transitions, perhaps implementable in R with ggplot2 or something interactive which would be implementable with d3.js (I am new to d3.js so I'm looking for a chance to try it out!)
If example code is available that would be fantastic, however I'm not so worried about that, and instead wish to focus on how best this information could be visualised. A type of sankey or chord diagram is coming to mind, but overall I am unsure.