[R] referencing last row in a column

Petr PIKAL petr.pikal at precheza.cz
Thu Sep 23 13:46:37 CEST 2010


Hi

the other option to get last item is

tail(pheno.dt$year,1)

Regards
Petr

r-help-bounces at 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.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, fugelpitch a écrit :
> > 
> >> 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, xlim = c(pheno.dt$year[1]:pheno.dt$year[nrow(pheno.dt)]), 
ylim =
> >>> 50:150, xlab = "Year", ylab = "Julian Day")
> >>> 
> >> Error in plot.window(...) : invalid 'xlim' value
> >> Calls: plot ->   plot.default ->   localWindow ->   plot.window
> >> 
______________________________________________________________________________
> >> 
> > 
> >
> >
> > ______________________________________________
> > 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.
> > 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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