Constructing a transition matrix from two vectors in R : <p>I am trying to visualize the transition frequency of a process. I have the following data></p>

<pre><code>from  to
1    4  
4    5
1    3
1    3
4    5
...
</code></pre>

<p>What I am trying to do is create a heatmap of frequency matrix of those transitions, so for upper example, </p>

<pre><code>  1 3 4 5
1 0 2 1 0
3 0 0 0 0
4 0 0 0 2
5 0 0 0 0
</code></pre>

<p>Before I reinvent the wheel, are there any predefined functions in R, which could give me such result?</p>

<p>Thanks!</p>
