inSeconds: Convert time units
Description
In addition to using the lubridate package, some additional functions
to work with times are provided.
This function takes a numeric with a "unit" attribute and converts it to
another numeric with a different time attribute.
If the units passed to argument units are the same as
attr(time, "unit"), then it simply returns input time.Usage
inSeconds(unit)
## S3 method for class 'character':
inSeconds(unit)
## S3 method for class '`NULL`':
inSeconds(unit)
convertTimeunit(time, unit)
## S3 method for class 'numeric,character':
convertTimeunit(time, unit)
## S3 method for class 'numeric,missing':
convertTimeunit(time)
.spadesTimes
spadesTimes()
Arguments
unit
Character. One of the time units used in SpaDES.
time
Numeric. With a unit attribute, indicating the time unit of the
input numeric. See Details.
Value
- A numeric vector of length 1, with
unit attribute set to
"seconds".
format
chr [1:6] "^years?$" "^months?$" "^weeks?$" "^days?$" "^hours?$" ...Details
Currently available units are found within the spadesTimes() function.
If time has no units attribute, then it is assumed to be
seconds.