November 2018
Beginner to intermediate
420 pages
10h 4m
English
Parsing date-time values in any platform can be a tedious operation, not least because of the various formats in which dates and times can be written.
The lubridate package makes it easy for anyone to work with dates and times in R. In addition, data.table also includes several helpful functions in order to work with date and time values:
Install.packages("lubridate")
library(lubridate)
We can create a sample table with dates and times as follows:
tdate <- data.frame(dt=(as.POSIXct("2010-03-18 19:08:10 EDT")) + 1000000 * runif(1000,-100,100), value=sample(LETTERS,1000,T))
head(tdate)
str(tdate)
Note that the dt column is already defined as of class POSIXct. However, in general, when reading date times ...
Read now
Unlock full access