Have a dataset yt_videos I scraped from YouTube
| id | Duration |
|---|---|
| 01 | PT5M28S |
| 02 | PT10M |
| 03 | PT1H2M21S |
| 04 | PT1H54M |
| 05 | PT1H27S |
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
| id | Duration |
|---|---|
| 01 | 328 |
| 02 | 600 |
| 03 | 3741 |
| 04 | 6840 |
| 05 | 7227 |
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?