Re: [R] How to refer to the last a few rows?

2009-09-14 Thread Giovanni Petris
> Date: Mon, 14 Sep 2009 10:32:09 -0500 > From: Peng Yu > > Hi, > > x=matrix(1:60,nr=6) > > I can refer the last 2 rows by > x[5:6,] > > If I don't know the total number of rows is 6, is there a way to refer But R does known the total number of rows: it's NROW(x) -- or nrow(x) if you are sur

Re: [R] How to refer to the last a few rows?

2009-09-14 Thread Bert Gunter
the last a few rows? Try the tail() function -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu Sent: Monday, September 14, 2009 11:32 AM To: r-h...@stat.math.ethz.ch Subject: [R] How to refer to the last a few rows? Hi, x

Re: [R] How to refer to the last a few rows?

2009-09-14 Thread Federman, Douglas
Try the tail() function -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu Sent: Monday, September 14, 2009 11:32 AM To: r-h...@stat.math.ethz.ch Subject: [R] How to refer to the last a few rows? Hi, x=matrix(1:60,nr=6) I

Re: [R] How to refer to the last a few rows?

2009-09-14 Thread baptiste auguie
Hi, tail(x,2) or x[seq(nrow(x)-1, nrow(x)), ] HTH, baptiste 2009/9/14 Peng Yu > Hi, > > x=matrix(1:60,nr=6) > > I can refer the last 2 rows by > x[5:6,] > > If I don't know the total number of rows is 6, is there a way to refer > the last 2 rows? > > Regards, > Peng > > _

[R] How to refer to the last a few rows?

2009-09-14 Thread Peng Yu
Hi, x=matrix(1:60,nr=6) I can refer the last 2 rows by x[5:6,] If I don't know the total number of rows is 6, is there a way to refer the last 2 rows? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE