Re: [R] counting run lengths

2008-10-27 Thread Mario Lavezzi
very grateful. Thanks to all! Mario -- Andrea Mario Lavezzi Dipartimento di Studi su Politica, Diritto e Società Università di Palermo Piazza Bologni 8 90134 Palermo, Italy tel. ++39 091 6625600 fax ++39 091 6112023 skype: lavezzimario email: lavezzi (at) unipa.it web: http://www.unipa.it/~lavezz

Re: [R] counting run lengths

2008-10-27 Thread Mario Lavezzi
unSpells <- colSums(Atr == 0) unSpells[unSpells == 0] <- 1 unSpells I hope it helps. Best, Dimitris Mario Lavezzi wrote: Hello, I have the following problem. I am running simulations on possible states of a set of agents (1=employed, 0=unemployed). I store these simulated time series in a

[R] counting run lengths

2008-10-27 Thread Mario Lavezzi
how to avoid this loop? (or in general, to speed up this part of the simulation) Thanks!! Mario -- Andrea Mario Lavezzi Dipartimento di Studi su Politica, Diritto e Società Università di Palermo Piazza Bologni 8 90134 Palermo, Italy tel. ++39 091 6625600 fax ++39 091 6112023 skype: lavezzimario em