Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Convert ISO 8601 string to time format r

$
0
0

Have a dataset yt_videos I scraped from YouTube

idDuration
01PT5M28S
02PT10M
03PT1H2M21S
04PT1H54M
05PT1H27S

The duration column represents the length of the video in hour, minutes and seconds. I am trying to convert it to r time format and then to an integer of only seconds like

idDuration
01328
02600
033741
046840
057227

I have tried using the parse_ISO_8601_datetime() function but get the error:

Warning message:In parse_ISO_8601_datetime(yt_videos$duration) : Invalid entries:

I also tried the anytime() function but it returns wrong results:

  [1] "1400-05-27 22:58:45 LMT" NA                        "1400-04-30 22:58:45 LMT" NA                         [5] NA                                               

What do I do?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>