How to avoid that anytime(<numeric>) “updates by reference”?
问题 I want to convert a numeric variable to POSIXct using anytime . My issue is that anytime(<numeric>) converts the input variable as well - I want to keep it. Simple example: library(anytime) t_num <- 1529734500 anytime(t_num) # [1] "2018-06-23 08:15:00 CEST" t_num # [1] "2018-06-23 08:15:00 CEST" This differs from the 'non-update by reference' behaviour of as.POSIXct in base R: t_num <- 1529734500 as.POSIXct(t_num, origin = "1970-01-01") # [1] "2018-06-23 08:15:00 CEST" t_num # 1529734500