Re: [R] referencing last row in a column

2010-09-23 Thread Petr PIKAL
Hi the other option to get last item is tail(pheno.dt$year,1) Regards Petr r-help-boun...@r-project.org napsal dne 23.09.2010 12:02:35: > Yes, thanks! :) > > 2010-09-23 11:55, Ivan Calandra skrev: > >Hi, > > xlim and ylim should be given the extremes only: > > > > plot(x,y, xlim=c(pheno.d

Re: [R] referencing last row in a column

2010-09-23 Thread Jonas Josefsson
Yes, thanks! :) 2010-09-23 11:55, Ivan Calandra skrev: >Hi, > xlim and ylim should be given the extremes only: > > plot(x,y, xlim=c(pheno.dt$year[1],pheno.dt$year[nrow(pheno.dt)]), > ylim=c(50,150), xlab="Year", ylab="Julian Day") >^^

Re: [R] referencing last row in a column

2010-09-23 Thread Ivan Calandra
Hi, xlim and ylim should be given the extremes only: plot(x,y, xlim=c(pheno.dt$year[1],pheno.dt$year[nrow(pheno.dt)]), ylim=c(50,150), xlab="Year", ylab="Julian Day") ^^ ^^ Does it work now? Ivan Le 9/23/2010 11:44, fuge

Re: [R] referencing last row in a column

2010-09-23 Thread peter dalgaard
On Sep 23, 2010, at 11:44 , fugelpitch wrote: > > Sorry, but now I understand what you're doing, and it works as a stand-alone > in the console! :) > > But why doesn't it work in the xlim? You have a colon where a comma would work. BTW: Wouldn't xlim=range(pheno.dt$year) be more expedient? >

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
OK, got it to work now, just messed up the ","' and ":". Thank you! -- View this message in context: http://r.789695.n4.nabble.com/referencing-last-row-in-a-column-tp2551645p2551721.html Sent from the R help mailing list archive at Nabble.com. __ R-he

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
Sorry, but now I understand what you're doing, and it works as a stand-alone in the console! :) But why doesn't it work in the xlim? __ > pheno.dt$year[1] [1] 1877 > pheno.dt$year[nrow(pheno.dt)] [1] 1916 > plot(x,y, x

Re: [R] referencing last row in a column

2010-09-23 Thread fugelpitch
Thanks, but I have multiple entries for each year so the column reads: year 1877 1877 1877 1877 1878 1878 1878 1878 1879 1879 1879 1879 So I need to pick out the year from the last row rather than just counting rows. -- View this message in context: http://r.789695.n4.nabble.com/referencin

Re: [R] referencing last row in a column

2010-09-23 Thread Michael Bedward
You could do data$year[ nrow(data) ] On 23 September 2010 18:56, fugelpitch 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 la

[R] referencing last row in a column

2010-09-23 Thread fugelpitch
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 f