'Convert seconds to hh:mm in gtsummary table

I have a variable that is a difference variable (surgical duration). When I run it through gtsummary, it runs the stats and returns that the surgery was 27,960 seconds in group A, and 29,940 seconds in Group B.

Is there a way for gtsummary to return that as hours:minutes?

I tried converting the variable to as.period() but got an error:

"There was an error calculating the summary statistics for "surg_total". Is this variable's class supported by `median` and `quantile`?"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source