Re: [R] Expanding dataset on the values of one of its variables

2014-07-06 Thread Clive Nicholas
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 > 1ARG 19861 6 0 1 40 0 1893 93 > 8 0 > 1.

Re: [R] Expanding dataset on the values of one of its variables

2014-07-06 Thread arun
Hi, 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 

[R] Expanding dataset on the values of one of its variables

2014-07-06 Thread Clive Nicholas
Hello! I have a dataset which is perhaps rather topical at about this time: > wc=read.delim("/home/openclive/Documents/worldcup.csv",header=T,sep="\t",fill=T)> > head(wc,n=20) team year time score out top goals host format formed > culture wcups cholder times 1 ARG 19861 6 0 1