[R] Is there way to add a new row to a data frame in a specific location
dwinsemius at comcast.net
Fri Nov 25 20:16:35 CET 2011
On Nov 25, 2011, at 2:10 PM, Ian Strang wrote:
> This look really interesting but I don't understand what is happening.
> Please can someone explain the last line and what the bit in  is
You just stick the new line on the bottom and return the rows in the
order specified in the "i" argument to "[". It's just like vector
indexing except with rows.
 4 2 3 1
 1 3 2 4
> df = data.frame( A=c('a','b','c'), B=c(1,2,3), C=c(10,20,30),
> newrow = c('X', 100, 200)
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
West Hartford, CT
More information about the R-help