Time Series

Time Series Analysis II: zoo

zoo: S3 Infrastructure for Regular and Irregular Time Series (Z’s Ordered Observations)

An S3 class with methods for totally ordered indexed observations. It is particularly aimed at irregular time series of numeric vectors/matrices and factors. zoo’s key design goals are independence of a particular index/date/time class and consistency with ts and base R by providing methods to extend standard generics

Base Time-Series Objects stats::ts Credit: Time Series Analysis in R Part 1: The Time Series Object by DataSciencePlus

Time Series Analysis I: date and time

Date class from base::Date and lubridate d1 <- Sys.Date() d1; class(d1)

[1] "2018-09-12"

[1] "Date"

dates <- c("02/27/92", "02/27/92", "01/14/92") dd <- as.Date(dates, "%m/%d/%y") dd; class(dd)

[1] "1992-02-27" "1992-02-27" "1992-01-14"

[1] "Date"

d2 <- lubridate::as_date("2018-07-05") d2; class(d2)

[1] "2018-07-05"

[1] "Date"

POSIX* class from base::as.POSIX* POSIXt types, POSIXct and POSIXlt:

ct, calendar time, stores the number of seconds since the origin