Use dat$V3
to indicate how often you need each row of dat
, by feeding it into the times
parameter of rep()
:
> dat <- read.table(text='45.3, 17, 3
+ 48, 19, 2',sep=',')
> dat[rep(1:nrow(dat),times=dat$V3),]
V1 V2 V3
1 45.3 17 3
1.1 45.3 17 3
1.2 45.3 17 3
2 48.0 19 2
2.1 48.0 19 2