Re: [R] How do I use as.Date when day values are missing?

2008-02-25 Thread Peter Dalgaard
Gabor Grothendieck wrote: In looking at this again here is a slight simplification. Its now only one line: library(chron) x - c(01/00/05, 01/22/06) as.chron(sub(/00/, /15/, x)) + (regexpr(/00/, x) 0) / 2 [1] (01/15/05 12:00:00) (01/22/06 00:00:00) You don't really need chron

Re: [R] How do I use as.Date when day values are missing?

2008-02-25 Thread Gabor Grothendieck
On Mon, Feb 25, 2008 at 6:03 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: In looking at this again here is a slight simplification. Its now only one line: library(chron) x - c(01/00/05, 01/22/06) as.chron(sub(/00/, /15/, x)) + (regexpr(/00/, x) 0) / 2

Re: [R] How do I use as.Date when day values are missing?

2008-02-25 Thread Gabor Grothendieck
On Mon, Feb 25, 2008 at 7:40 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: On Mon, Feb 25, 2008 at 6:03 AM, Peter Dalgaard [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: In looking at this again here is a slight simplification. Its now only one line:

[R] How do I use as.Date when day values are missing?

2008-02-24 Thread Anupa Fabian
I have a data frame which contains some valuable date information. But for a few of the dates, the day information missing . Viz: interesting.data$date [1] 1/22/93 1/22/93 1/23/93 1/00/93 1/28/93 1/31/93 1/12/93 i.e. for dates where the day info is missing, the %d part of the %m/%d/%yy

Re: [R] How do I use as.Date when day values are missing?

2008-02-24 Thread Gabor Grothendieck
It really depends on what you want to do with them but one possibility might be to represent them as chron dates and use a time of 0 for true dates and noon for missing dates replacing the missing day with 01 or 15 or some other day: library(chron) x - c(01/00/05, 01/22/06) no.day -

Re: [R] How do I use as.Date when day values are missing?

2008-02-24 Thread Gabor Grothendieck
In looking at this again here is a slight simplification. Its now only one line: library(chron) x - c(01/00/05, 01/22/06) as.chron(sub(/00/, /15/, x)) + (regexpr(/00/, x) 0) / 2 [1] (01/15/05 12:00:00) (01/22/06 00:00:00) On Sun, Feb 24, 2008 at 9:45 PM, Gabor Grothendieck [EMAIL