How to transform hours, minutes, and seconds into seconds only in the R programming language. More details: 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
Негізгі бет Convert hms Object into Seconds in R | period_to_seconds() of lubridate Package | Hours & Minutes
Пікірлер: 13