Re: [R] Formatting durations

2010-10-27 Thread Gabor Grothendieck
On Wed, Oct 27, 2010 at 3:07 PM, Susanta Mohapatra wrote: > I have one more pattern to take care of. > What is happening is that if a string like "10 minutes and 30 seconds" comes > for parsing then the function generates 2 values both for 10 minutes and for > 30 seconds and the result list then h

Re: [R] Formatting durations

2010-10-27 Thread Susanta Mohapatra
I have one more pattern to take care of. What is happening is that if a string like "10 minutes and 30 seconds" comes for parsing then the function generates 2 values both for 10 minutes and for 30 seconds and the result list then has 2 elements. So when I use unlist function then try to merge wit

Re: [R] Formatting durations

2010-10-27 Thread Susanta Mohapatra
Thanks Gabor, It is a very tricky task and your comment helped. I modified the function to handle average of two numbers when it is like 2-3 minutes. I also improved on the regex part to parse the decimal parts also. Right now i can parse 100% of one sample. Thanks Susanta On Wed, Oct 27, 2010 a

Re: [R] Formatting durations

2010-10-26 Thread Gabor Grothendieck
On Tue, Oct 26, 2010 at 7:17 PM, Gabor Grothendieck wrote: > On Tue, Oct 26, 2010 at 3:28 PM, Susanta Mohapatra > wrote: >> Hi, >> >> I am working with a dataset for sometime and I need some help in parsing >> some data. >> >> There is a column called "Duration" which has data like following: >>

Re: [R] Formatting durations

2010-10-26 Thread Gabor Grothendieck
On Tue, Oct 26, 2010 at 3:28 PM, Susanta Mohapatra wrote: > Hi, > > I am working with a dataset for sometime and I need some help in parsing > some data. > > There is a column called "Duration" which has data like following: > > 2 minutes => 120 > 2 min => 120 > 10 seconds =>10 > 2 hrs =>7200 >  2

[R] Formatting durations

2010-10-26 Thread Susanta Mohapatra
Hi, I am working with a dataset for sometime and I need some help in parsing some data. There is a column called "Duration" which has data like following: 2 minutes => 120 2 min => 120 10 seconds =>10 2 hrs =>7200 2-3 minutes => 150 or 120 5 minutes (when i arrived => 300 Flyby approx 20 sec. =