On second thought, going down the rabbit hole into date time may not be the best way to end up with a number of seconds if, indeed, you're dealing solely with "9m2.75s" that you want to convert to integers.
Here is a clunky example of taking this as a string parsing and conversion problem. Needs adjustment, obviously, if fractional seconds are not guaranteed in the input.
library(stringr)
get_secs <- function(x) {
pattern <- "\\d+"
str_extract_all(x, pattern)
}
make_secs <- function(x) {
big_secs <- as.integer(x[[1]][1]) * 60
reg_secs <- as.integer(x[[1]][2])
frac_secs <- ifelse(as.integer(x[[1]][3]) > 49, 1, 0)
tot_secs <- big_secs + reg_secs + frac_secs
}
exemplar <- "9m2.75s"
sec_chars <- get_secs(exemplar)
result <- get_secs(exemplar) %>% make_secs()
result
#> [1] 543
Created on 2019-11-28 by the reprex package (v0.3.0)