[R] iterating over a data frame the R way?

donahchoo at me.com donahchoo at me.com
Fri Jan 1 00:59:54 CET 2010


On Dec 31, 2009, at 5:46 PM, William Dunlap wrote:
>
>> mytable$duration <- mytable$end_time - mytable$start_time
>> mytable
>             start_time            end_time    duration
> 1  2009-12-31 15:27:00 2009-12-31 15:27:00      0 secs
> 2  2009-12-31 16:27:00 2010-01-01 15:27:00  82800 secs
> ...
> 11 2010-01-01 01:27:00 2010-01-10 15:27:00 828000 secs
> 12 2010-01-01 02:27:00 2010-01-11 15:27:00 910800 secs
>

okay, that's cool.

periods$sql <- sprintf("select * from data where start_time >= periods 
$start_time and start_time <= periods$end_time")



More information about the R-help mailing list