I have data in a form of:
id state
1 s_1
1 s_2
1 s_3
2 s_1
2 s_3
3 s_1
3 s_2
And I'd like to have it in connecion data frame:
source target freq
s_1 s_2 2
s_1 s_3 1
s_2 s_3 1
I already know I can calculate the frequencies by using plyr::count(), but how to reflow the data into source and target type?