[R] reset row numbers when extracting a subset of a table

2008-06-24 Thread naw3
Hi I created a new table by extracting only certain rows of table, but the row numbers in my new table correspond to those from the original table. Is there a way to reset the row numbers in my new table so that they start from one? like below: my table: COL1 COL2 17 v 45 18 b

Re: [R] reset row numbers when extracting a subset of a table

2008-06-24 Thread Gabor Csardi
Nina, these are not row NUMBERS, but row NAMES. Numbers are actually reset, they always start with 1 and they are continuous. Just try doing T[1,] on your table. If you want to reset row names, you can do this: rownames(T) - seq(length=nrow(T)) or you can even remove them: rownames(T) -

Re: [R] reset row numbers when extracting a subset of a table

2008-06-24 Thread Gabor Grothendieck
I assume that by table you mean data frame. Using the built in data frame, BOD, try this: ix - 2:4 BOD[ix, ] Time demand 22 10.3 33 19.0 44 16.0 data.frame(BOD[ix, ], row.names = seq_along(ix)) Time demand 12 10.3 23 19.0 34 16.0 On Tue, Jun 24, 2008