[R] sorting by date

Nikhil Kaza nikhil.list at gmail.com
Tue Aug 3 02:59:40 CEST 2010


 > a <- c( 20071031,20071130, 20071231)
b<- sort(as.Date(as.character(a), format="%Y%M%d"))

On Aug 2, 2010, at 8:03 PM, Leigh E. Lommen wrote:

> I am unsure how to sort a column by date if it is currently in the  
> form:
>
> YYYYMMDD
>
>
>
> For example the months:
>
> 20071031
>
> 20071130
>
> 20071231
>
> Etc.
>
>
>
> Regards,
>
> Leigh
>
>
> 	[[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