title: My function for converting numeric seconds to HH:MM:SS is not working
body: <p>I wrote function below to convert numeric value for seconds to format</p>
  <p>HH:MM:SS</p>
  <pre><code>    my_to_time &lt;- function(sec_vec_num,hours = T){
        sec_vec = seconds_to_period(sec_vec_num)
        if(hours == T){
          sec_vec = sprintf('%01g:%02g:%02g', sec_vec@hour, minute(sec_vec), second(sec_vec))
        }else{
          sec_vec = sprintf('%01g:%02g', minute(sec_vec), second(sec_vec))
        }
        return(sec_vec)
  
  }
  </code></pre>
  <p>When I try to run this, I get following error though</p>
  <pre><code> Error in as.POSIXlt.numeric(x) : 'origin' must be supplied 
  </code></pre>
  <p>The vector I am converting is numeric class. Not sure how to fix this error.</p>