Is there a way to convert mm:ss.00 to seconds.00?

前端 未结 6 1761
离开以前
离开以前 2020-12-30 03:12

I\'ve got some performance time data in mm:ss.00 format (i.e. 02:15.45, or 00:34.58). R is recognizing the variable as a factor, but I\'d like to convert each performance t

6条回答
  •  粉色の甜心
    2020-12-30 03:56

    You can do this easily with the Lubridate package. If you use the format "h:m:s" you can convert the variable to a lubridate object with

    hms("12:12:54")
    

    And then convert it to seconds with

    seconds(hms("12:12:54"))
    

    Here is a link to the lubridate article in JSS

    http://www.jstatsoft.org/v40/i03/paper

提交回复
热议问题