[R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread liujb
Hello, I have a set of data that has a Date column looks like this: 12/9/2007 12/16/2007 1/1/2008 1/3/2008 1/12/2008 etc. I'd like the date to look something like the follow (so that I could sort by date easily). 20071209 20071216 20080101 20080103 20080112 How to do it? Thank you very much

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Whit Armstrong
warmstr...@research:~$ R strptime(12/9/2007,%m/%d/%Y) [1] 2007-12-09 format(strptime(12/9/2007,%m/%d/%Y),%Y%m%d) [1] 20071209 On Tue, Jul 21, 2009 at 1:16 PM, liujbliujul...@yahoo.com wrote: Hello, I have a set of data that has a Date column looks like this: 12/9/2007 12/16/2007

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Chuck Cleland
On 7/21/2009 1:16 PM, liujb wrote: Hello, I have a set of data that has a Date column looks like this: 12/9/2007 12/16/2007 1/1/2008 1/3/2008 1/12/2008 etc. I'd like the date to look something like the follow (so that I could sort by date easily). 20071209 20071216 20080101

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread John Kane
to transform m/d/ to mmdd? To: r-help@r-project.org Received: Tuesday, July 21, 2009, 1:16 PM Hello, I have a set of data that has a Date column looks like this: 12/9/2007 12/16/2007 1/1/2008 1/3/2008 1/12/2008 etc. I'd like the date to look something like the follow (so that I

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Gabor Grothendieck
Assuming that there are no duplicate dates, try this using zoo and chron: Lines - 12/9/2007 0 + 12/16/2007 1 + 1/1/2008 2 + 1/3/2008 3 + 1/12/2008 4 library(zoo) library(chron) z - read.zoo(textConnection(Lines), FUN = chron) z # is automatically sorted by times 12/09/07 12/16/07 01/01/08