Convert hms Object into Seconds in R | period_to_seconds() of lubridate Package | Hours & Minutes

Published: 05 October 2022
on channel: Statistics Globe
851
22

How to transform hours, minutes, and seconds into seconds only in the R programming language. More details: https://statisticsglobe.com/convert-h...
R code of this video:

my_hms <- c("00:10:25", # Create vector of hms strings
"00:04:04",
"00:01:20",
"00:11:42")
my_hms # Print vector of hms strings

class(my_hms) # Check class of data object

install.packages("lubridate") # Install lubridate package
library("lubridate") # Load lubridate package

my_hms_lubri <- lubridate::hms(my_hms) # Convert character to Period
my_hms_lubri # Print Period object

class(my_hms_lubri) # Check class of data object

my_seconds <- period_to_seconds(my_hms_lubri) # Convert Period to seconds
my_seconds # Print seconds

class(my_seconds) # Check class of data object

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


Watch video Convert hms Object into Seconds in R | period_to_seconds() of lubridate Package | Hours & Minutes online, duration hours minute second in high quality that is uploaded to the channel Statistics Globe 05 October 2022. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 851 times and liked it 22 visitors.