Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-06 Thread esp
Thank you all who replied, I will try out these ideas later today. David Esp -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25763935.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-06 Thread Gabor Grothendieck
See below. On Mon, Oct 5, 2009 at 6:50 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this.  First we read a line at a time into L except for the header.  Then we use strapply to match on the given pattern.  It passes the backreferences (the portions within parentheses in the

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-06 Thread esp
esp wrote: For the function as defined above using 'sapply' spot[,1] 01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009 00:00:03 1251759600 1251759601 1251759602 1251759603 This was unexpected - it seems to have displayed the

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-06 Thread esp
Another solution, as a fix to my original algorithm, was found by a colleague (Matthew Roberts). While he claims not too much for its elegance, it does seem to work. This fix is based on the use of the 'pmax' function. This function is a variant of the 'max' (maximum) function to return a

[R] Date-Time-Stamp input method for user-specific formats

2009-10-05 Thread esp
Date-Time-Stamp input method to correctly interpret user-specific formats:coding is 90% there - based on exmple at http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html ...anyone got the last 10% please? CONTEXT: Data is received where one of the columns is a datetimestamp. At midnight,

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-05 Thread Don MacQueen
Off the top of my head, I think you're working to hard at this. I would read in the timestamp column as a character string. Then, find those where the string length is too short [using nchar()], append 00:00:00 to those [using paste()], and then convert to POSIXt [using as.POSIXct()]. No

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-05 Thread David Winsemius
On Oct 5, 2009, at 5:14 PM, esp wrote: Date-Time-Stamp input method to correctly interpret user-specific formats:coding is 90% there - based on exmple at http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html ...anyone got the last 10% please? CONTEXT: Data is received where one of the

Re: [R] Date-Time-Stamp input method for user-specific formats

2009-10-05 Thread Gabor Grothendieck
Try this. First we read a line at a time into L except for the header. Then we use strapply to match on the given pattern. It passes the backreferences (the portions within parentheses in the pattern) to the function (defined via a formula) whose implicit arguments are x, y and z. That