[R] referencing last row in a column

Michael Bedward michael.bedward at gmail.com
Thu Sep 23 11:07:58 CEST 2010


You could do data$year[ nrow(data) ]

On 23 September 2010 18:56, fugelpitch <jonas at runtimerecords.net> wrote:
>
> I am trying to set u a limit for my plot window according to the range of a
> year column I have.
> The first year in the range is just simply the first row, referred to as
> data$year[1]. How can I find the last row in a similar way to set the last
> year in the range?
>
> What I want to accomplish is the following: "plot(....,xlim =
> c(data$year[1], data$data[lastrow]),...)", is this possible?
> --
> View this message in context: http://r.789695.n4.nabble.com/referencing-last-row-in-a-column-tp2551645p2551645.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list