On 12/12/2012, Daniel Nordlund <djnordl...@frontier.com> wrote: >> -----Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf Of e-letter >> Sent: Tuesday, December 11, 2012 11:45 PM >> To: r-help@r-project.org >> Subject: [R] remove last row of a data frame >> >> Readers, >> >> For a data set 'a': >> >> 1 >> 2 >> 3 >> 4 >> >> Please what is the syntax to remove the last row and create a new object >> 'b': >> >> 1 >> 2 >> 3 >> >> Thanks. >> > > If by data set a you mean a data frame called a, then something like this > should work: > > b <- a[-nrow(a),] > > If you haven't already read the manual, "An Introduction to R", that ships > with every copy of R, then now is the time. >
Thanks, couldn't find quickly the relevant section in the html document, but within R, the command 'nrow' is relevant. ______________________________________________ R-help@r-project.org 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.