Arun K,

Not sure about the expected output.
>
> If `dat` is the dataset:
> res <- dat[rep(1:nrow(dat), dat$score),]
> head(res,7)
>     team year time score out top goals host format formed culture wcups
> cholder
> 1    ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 1.1  ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 1.2  ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 1.3  ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 1.4  ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 1.5  ARG 1986    1     6   0   1     4    0      0   1893      93
> 8       0
> 2    ARG 1990    2     5   1   0     1    0      0   1893      97
> 9       0
>     times cards      gdp
> 1       6    12 6146.155
> 1.1     6    12 6146.155
> 1.2     6    12 6146.155
> 1.3     6    12 6146.155
> 1.4     6    12 6146.155
> 1.5     6    12 6146.155
> 2       6    25 5800.057


I really should have known that -rep()- would have been useful here; it has
been extremely useful to me in other matters, but I would never in a
million years have known that exact code.

Anyway, your solution works. Thank you very much! :)

-- 
Clive Nicholas

"My colleagues in the social sciences talk a great deal about methodology.
I prefer to call it style." -- Freeman J. Dyson

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to