NIEHS / amadeus

https://niehs.github.io/amadeus/
Other
7 stars 1 forks source link

use `lubridate` for `$time` column in covariates data frame #74

Closed mitchellmanware closed 4 months ago

mitchellmanware commented 7 months ago

https://rawgit.com/rstudio/cheatsheets/main/lubridate.pdf

kyle-messier commented 7 months ago

@mitchellmanware I wasn't necessarily saying we have to use to lubridate but to look at that package for the best standards and flexibility for time in R. lubridate very well may be that, but I'm not sure.

mitchellmanware commented 7 months ago

I will have to compare its functions with base R's series of as.POSIXct functions, as I know the latter can be used for dates and dates + hours minutes and seconds but I do not know how they handle years or months.

It might also be helpful for the models themselves as lubridate is a tidyverse package.

sigmafelix commented 7 months ago

I agree lubridate is very convenient with neat syntax to accommodate generic strings and tidy datetime class. If we agree on adding dependency, it will work per se, but one thing I want to note is that POSIXct and POSIXlt (more human-readable kind of POSIXct) with combination of strftime works pretty well in performance comparable to lubridate. As a side note, terra::time() returns values in POSIXct class.

mitchellmanware commented 4 months ago

Check for and coercion to POSIXt format is implemented. Format is preferred to lubridate for using base R functionality when possible.