On 2010-05-17 9:28, ecvet...@uwaterloo.ca wrote:
I have a large data frame 48:2185 with different numbers.
I would like to add only one row at the very top of my data frame with
0's or NA's.
I don't know which approach to use. Should i create 2 different data
frames and merge them? Ive also tried the rbind command with no luck. I
would appreciate some help to achieve what I'm trying to create.
Thanks!

Say your dataframe is named 'dat'.

 x <- rep(NA, ncol(dat))
 dat <- rbind(x, dat)

will insert a row of NA's.

 x <- rep(0, ncol(dat))
 dat <- rbind(x, dat)

will insert a row of 0s. If any of your variables are not
numeric or character, you'll get a warning.

 -Peter Ehlers

______________________________________________
R-help@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.

Reply via email to