[R] How to append to a data.frame? 
    David Kreil 
    kreil at ebi.ac.uk
       
    Tue Dec  9 09:05:17 CET 2003
    
    
  
Ok, how can I both allocate storage and specify column names in a data.frame 
call, please? Apologies if I'm being slow here.
With many thanks again,
David.
> > Yes, once I've named the first column, I can add further ones by saying 
> > d[c("x","y","z")]=NA or such. I was just wondering whether that was the way to 
> > do it or whether there was a more elegant approach. Preallocation was the 
> > critical clue I needed.
> 
> Use an initial data.frame call naming all the columns.
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
------------------------------------------------------------------------
Dr David Philip Kreil                 ("`-''-/").___..--''"`-._
Research Fellow                        `6_ 6  )   `-.  (     ).`-.__.`)
University of Cambridge                (_Y_.)'  ._   )  `._ `. ``-..-'
++44 1223 764107, fax 333992         _..`--'_..-_/  /--'_.' ,'
www.inference.phy.cam.ac.uk/dpk20   (il),-''  (li),'  ((!.-'
    
    
More information about the R-help
mailing list