[R] Inserting rows

John Kane jrkrideau at yahoo.ca
Fri Oct 23 16:20:40 CEST 2009


?rbind

df1 <- data.frame(matrix(rep(0,9),nrow=3))
names(df1) <- c("x1","x2","x3")

rbind(df,df1)

--- On Fri, 10/23/09, Ashta <sewashm at gmail.com> wrote:

> From: Ashta <sewashm at gmail.com>
> Subject: [R] Inserting rows
> To: "R help" <r-help at r-project.org>
> Received: Friday, October 23, 2009, 9:44 AM
> Hi all,
> 
> I have the data set  df with three varaibles,
> 
> x1 x2 x3
> 1  2   5
> 2  4   1
> 5  6   0
> 1  1   2
> 
> I want to insert more rows ( eg, 3 rows with value 
> filled with zeros)
> 1  2   5
> 2  4   1
> 5  6   6
> 1  1   2
> 0  0  0
> 0  0  0
> 0  0  0
> 
> Can any body help me out?
> 
> Thanks
> 
> ______________________________________________
> R-help at 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.
> 


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/




More information about the R-help mailing list