I am simply trying to store lubridate timestamps in a dataframe. However, they get converted in number of seconds.
Here's a reproducible example:
library(lubridate)
tsta <- ymd_hms('2021-03-16 22:59:59') # tsta for timestamp
df <- as.data.frame(matrix(ncol=1, nrow=2)) # preallocate a small dataframe
colnames(df) <- 'timestamp'
# trying to add lubridate object in it
df[1, 'timestamp'] <- tsta
So tsta looks like "2021-03-16 22:59:59 UTC", but once I put it in df it looks like
timestamp
1 1615935599
2 NA
What's the proper way of doing this?