search for: dt2df

Displaying 2 results from an estimated 2 matches for "dt2df".

2020 Apr 04
5
Help useRs to use R's own Time/Date objects more efficiently
...these simple utility functions. ------------------------------------------------ ## Show how easily you get month, day, year, day (of {month, week, yr}), ... : ## (remember to count from 0 (!): mon = 0..11, wday = 0..6, etc !!) ##' Transform (Time-)Date vector to convenient data frame : dt2df <- function(dt, dName = deparse(substitute(dt)), stringsAsFactors = FALSE) { DF <- as.data.frame(unclass(as.POSIXlt( dt )), stringsAsFactors=stringsAsFactors) `names<-`(cbind(dt, DF, deparse.level=0L), c(dName, names(DF))) } dt2df(.leap.seconds) # date+time dt2df(Sys.Date() + 0:...
2020 Apr 05
0
Help useRs to use R's own Time/Date objects more efficiently
...; > ------------------------------------------------ > > ## Show how easily you get month, day, year, day (of {month, week, yr}), ... : > ## (remember to count from 0 (!): mon = 0..11, wday = 0..6, etc !!) > > ##' Transform (Time-)Date vector to convenient data frame : > dt2df <- function(dt, dName = deparse(substitute(dt)), stringsAsFactors = FALSE) { > DF <- as.data.frame(unclass(as.POSIXlt( dt )), stringsAsFactors=stringsAsFactors) > `names<-`(cbind(dt, DF, deparse.level=0L), c(dName, names(DF))) > } > dt2df(.leap.seconds) # date+time &...