You can try the following: n.len <- nrow(iris) n.sel <- 3
iris[(n.len-n.sel+1):n.len, ] -Christos > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Lauri Nikkinen > Sent: Tuesday, March 20, 2007 10:33 AM > To: [email protected] > Subject: [R] Select the last two rows by id group > > Hi R-users, > > Following this post > http://tolstoy.newcastle.edu.au/R/help/06/06/28965.html , how > do I get last two rows (or six or ten) by id group out of the > data frame? Here the example gives just the last row. > > Sincere thanks, > Lauri > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. > > ______________________________________________ [email protected] 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.
