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 mailin

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

2011-03-18 Thread rex.dwyer
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 with regex for speed ? Try this: sub("\\.(\\d+)$", "\\1", ts) On Thu, Mar 17, 2011 at 11:01 PM, rivercode wrote: > > Have timest

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 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 > of row

[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] 09:30:00