Skip to content

Commit

Permalink
Coerce dates to doubles
Browse files Browse the repository at this point in the history
Fixes #72
  • Loading branch information
jeroen committed Jan 5, 2024
1 parent f3de8eb commit 1751eea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/write_xlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ normalize_df <- function(df){
for(i in which(vapply(df, inherits, logical(1), c("factor", "hms")))){
df[[i]] <- as.character(df[[i]])
}
for(i in which(vapply(df, function(x){is.integer(x) && inherits(x, "POSIXct")}, logical(1)))){
df[[i]] <- as.double(df[[i]])
class(df[[i]]) <- class(Sys.time())
}
for(i in which(vapply(df, inherits, logical(1), "POSIXlt"))){
df[[i]] <- as.POSIXct(df[[i]])
}
Expand Down

0 comments on commit 1751eea

Please sign in to comment.