Hello,
I have a dataframe where I was able to convert all the values into the hms format, but none of my times have anything in the hours place because they are swimming times. Is there a way to remove it so it only shows minutes and seconds. It is only for the purpose of cleaning up my table so it does not need to remain in the same format.
Here's a simpler version of my data:
library(hms)
df <- data.frame(Name = c("Swimmer 1","Swimmer 2", "Swimmer 3"),
Event.1 = c(22.50,25.90,27.56),
Event.2 = c(54.23,"1:01.13",59.54),
Event.3 = c("1:41.12","1:58.13","2:03.15")
)
data.2 <- df %>%
mutate(across(.cols = -Name,
.fns = ~ if_else(!str_detect(., ":"), paste0("00:00:", .), paste0("00:", .))),
across(.cols = -Name,
.fns = parse_hms))