Re: [R] Replace split with regex for speed ?

2011-03-19 Thread rivercode
Thanks for your suggestions. Cheers, Chris -- View this message in context: http://r.789695.n4.nabble.com/Replace-split-with-regex-for-speed-tp3386098p3388958.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Replace split with regex for speed ?

2011-03-18 Thread Henrique Dallazuanna
Try this: sub(\\.(\\d+)$, \\1, ts) On Thu, Mar 17, 2011 at 11:01 PM, rivercode aqua...@gmail.com wrote: Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last . so it is in format HH:MM:SS.MMMUUU. What is the fastest way to do this, since it has to be repeated on millions

Re: [R] Replace split with regex for speed ?

2011-03-18 Thread rex.dwyer
=)) user system elapsed 0.880.000.89 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique Dallazuanna Sent: Friday, March 18, 2011 8:32 AM To: rivercode Cc: r-help@r-project.org Subject: Re: [R] Replace split

[R] Replace split with regex for speed ?

2011-03-17 Thread rivercode
Have timestamp in format HH:MM:SS.MMM.UUU and need to remove the last . so it is in format HH:MM:SS.MMMUUU. What is the fastest way to do this, since it has to be repeated on millions of rows. Should I use regex ? Currently doing it with a string split, which is slow: head(ts) [1]