[R] adding column of ordered numbers to matrix
Greg.Snow at imail.org
Thu Jun 10 19:32:16 CEST 2010
> newmat <- cbind( oldmat, order=seq(nrow(oldmat)) )
See ?seq and/or ?rev for descending.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Assa Yeroslaviz
> Sent: Thursday, June 10, 2010 7:56 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] adding column of ordered numbers to matrix
> Hello everyone,
> I have a matrix of over 40000 line and about 30 columns.
> For my analysis I would like to add another column with ascending
> (column header should be "order", and than 1,2,3,4 ....the end of the
> During my analysis I reorder them ( due to merge commands by a
> How do I add such a column in an ascending order (or descending for
> what it
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help