• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

在R添加时间戳?

用户头像
it1352
帮助1

问题说明

我有一个数据,其中包含事件的开始时间和结束时间之间的差异.现在我想添加差异.问题是时差的格式是

I have a data which have the difference between the start and end time of an event. Now I want to add the difference. the problem is the difference time is in format

difference_time
_______________
00:10:00
00:30:12
01:09:09
00:09:03
01:09:30
01:09:03
00:09:08
01:00:09
09:00:01

但是如果我执行 sum(df$difference_time) 它会抛出无效类型争论的错误.

But if I do sum(df$difference_time) it throws the error that invalid type of arguement.

我希望结果类似于以下格式:

I want the result to be something like below format:

51975 秒.任何帮助表示赞赏

51975 seconds. Any help is appreciated

更新:

我尝试了 period_to_seconds(hms(df$difference_time)) 并且它工作正常

I tried period_to_seconds(hms(df$difference_time)) and it works fine

正确答案

#1
period_to_seconds(hms(df$difference_time)) 

成功了.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfecbg
系列文章
更多 icon
同类精品
更多 icon
继续加载