search for: str_to_milli

Displaying 1 result from an estimated 1 matches for "str_to_milli".

Did you mean: str_to_millis
2007 Oct 08
2
Applying function to data.frame
Hi, If I have the following data.frame >y time val 1 08:00:05.834 1 2 08:03:13.345 2 3 08:10:12.443 3 > and the following function which converts the time string to the number of milliseconds since midnight > str_to_millis function( s ) { a <- as.numeric( unlist( strsplit(s,":",fixed="TRUE") ) ) m <- a[1]*3600000 + a[2]*60000 + a[3]*1000 } Then to get the time into millis since midnight I am doing this > transform( y, time=str_to_millis( as.character(time) ) ) time val 1 2880583...