[R] rbind and data.frame [simplified]

Göran Broström gb at stat.umu.se
Mon Dec 10 13:21:00 CET 2001


On 10 Dec 2001, Peter Dalgaard BSA wrote:

> Göran Broström <gb at stat.umu.se> writes:
> 
> 
> > > 
> > > What happens if you do do something like this?: Replace the
> > >   dat.out[cur.row, ] <- fixed.rec
> > > with 
> > >   for (i in 1:ncol) dat.out[[i]][cur.row] <- fixed.rec[[i]]
> > > 
> > > bypassing "[<-.data.frame"
> > > 
> > 
> > Timing stopped at: 529.27 122.76 668.1 0 0
> > 
> > i.e. catastrophic! I hadn't time to wait; this was with writing 100
> > records.
> 
> Oh. Yes, replacing [<-.data.frame with [[<-.data.frame is not going to
> work... 
> 
> Suppose you precede that with dat.out <- unclass(dat.out) ?
> (and end with dat.out <- as.data.frame(dat.out))

Yes, that's better:

> unix.time(koll(dat, com.dat, com.info[1, 1:2], 100)) 
[1] 6.75 2.23 9.14 0.00 0.00

but far from 'matrix behaviour'.

Göran
-- 
 Göran Broström                      tel: +46 90 786 5223
 professor                           fax: +46 90 786 6614
 Department of Statistics            http://www.stat.umu.se/egna/gb/
 Umeå University
 SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list