# [R] transitions in R

Greg Trafton trafton at itd.nrl.navy.mil
Mon Jul 9 21:57:41 CEST 2001

```Hi, All.  I'd have a set of data in an array:

process <- c( 5 , 7 , 4 , 1 , 4 , 1 , 4 , 1 , 4 , 4 , 1 , 5 , 4 , ...)

and I'd like to know the number of transitions in this data.  I
calculate transitions as the number of times a number follows another
number.  thus, something like this would be a 1 deep transition:

1 --> 1 : 10% (and actual number of 1 --> 1 occurrences)
1 --> 2 : 2%
1 --> 3 : 23%
...
2 --> 1 : 2%
2 --> 2 : 8%
(etc.)

of course, you can have 2 or 3 or n deep transitions, but I'm really
only interested in 1 and 2 (and maybe 3) deep transitions.

what is the best way of calculating this info in R?

thanks!
greg
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```