[R] Interlacing two vectors
Murray Jorgensen
maj at stats.waikato.ac.nz
Thu Aug 21 23:00:39 CEST 2003
Thanks for the ideas about this problem. It seems mean not to say why I
was doing this! I was writing a queue simulation one of whose outputs
was a list of pairs (t,n) [event time, number in system after event].
I wanted a plot of the step function showing number in the system as a
function of time. I did this by constructing two vectors: one with the
event times repeated twice, the other with the number in the system
before and after each event (interlacing the lagged numbers with the
numbers).
Then a simple plot(,,type="l") gives a nice visualization of the queue.
Murray
--
Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz Fax 7 838 4155
Phone +64 7 838 4773 wk +64 7 849 6486 home Mobile 021 1395 862
More information about the R-help
mailing list