问题
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
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 seconds. Any help is appreciated
UPDATE:
I tried period_to_seconds(hms(df$difference_time))
and it works fine
回答1:
period_to_seconds(hms(df$difference_time))
did the trick.
来源:https://stackoverflow.com/questions/44242291/how-to-add-timestamp-in-r