[R] Inserting rows

Henrique Dallazuanna wwwhsd at gmail.com
Fri Oct 23 15:52:28 CEST 2009


Try this:

rbind(df, matrix(0, 3, 3, dimnames = list(NULL, names(df))))


On Fri, Oct 23, 2009 at 11:44 AM, Ashta <sewashm at gmail.com> wrote:
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O




More information about the R-help mailing list