R/format.time.R

`format.time` <-
function (x,...) 
{
	res = c();

for (ii in 1:length(x)) 
  {

  if (is.finite(x[ii]))
  	{
        h = floor(x[ii]);
        m = (x[ii] %% 1)*60;
        s = round((m %% 1)*60);
        m = floor(m);

        res = c(res,paste(format(h,width=2),"h ",format(m,width=2),"m ",
                        format(s,width=2),"s",sep=""));
      }
	else
	res=c(res,"");
  }
	return(res);
}

Try the moonsun package in your browser

Any scripts or data that you put into this service are public.

moonsun documentation built on May 29, 2017, 12:17 p.m.