Transformation for dates (class Date).

date_trans()

Examples

years <- seq(as.Date("1910/1/1"), as.Date("1999/1/1"), "years") t <- date_trans() t$transform(years)
#> [1] -21915 -21550 -21185 -20819 -20454 -20089 -19724 -19358 -18993 -18628 #> [11] -18263 -17897 -17532 -17167 -16802 -16436 -16071 -15706 -15341 -14975 #> [21] -14610 -14245 -13880 -13514 -13149 -12784 -12419 -12053 -11688 -11323 #> [31] -10958 -10592 -10227 -9862 -9497 -9131 -8766 -8401 -8036 -7670 #> [41] -7305 -6940 -6575 -6209 -5844 -5479 -5114 -4748 -4383 -4018 #> [51] -3653 -3287 -2922 -2557 -2192 -1826 -1461 -1096 -731 -365 #> [61] 0 365 730 1096 1461 1826 2191 2557 2922 3287 #> [71] 3652 4018 4383 4748 5113 5479 5844 6209 6574 6940 #> [81] 7305 7670 8035 8401 8766 9131 9496 9862 10227 10592
t$inverse(t$transform(years))
#> [1] "1910-01-01" "1911-01-01" "1912-01-01" "1913-01-01" "1914-01-01" #> [6] "1915-01-01" "1916-01-01" "1917-01-01" "1918-01-01" "1919-01-01" #> [11] "1920-01-01" "1921-01-01" "1922-01-01" "1923-01-01" "1924-01-01" #> [16] "1925-01-01" "1926-01-01" "1927-01-01" "1928-01-01" "1929-01-01" #> [21] "1930-01-01" "1931-01-01" "1932-01-01" "1933-01-01" "1934-01-01" #> [26] "1935-01-01" "1936-01-01" "1937-01-01" "1938-01-01" "1939-01-01" #> [31] "1940-01-01" "1941-01-01" "1942-01-01" "1943-01-01" "1944-01-01" #> [36] "1945-01-01" "1946-01-01" "1947-01-01" "1948-01-01" "1949-01-01" #> [41] "1950-01-01" "1951-01-01" "1952-01-01" "1953-01-01" "1954-01-01" #> [46] "1955-01-01" "1956-01-01" "1957-01-01" "1958-01-01" "1959-01-01" #> [51] "1960-01-01" "1961-01-01" "1962-01-01" "1963-01-01" "1964-01-01" #> [56] "1965-01-01" "1966-01-01" "1967-01-01" "1968-01-01" "1969-01-01" #> [61] "1970-01-01" "1971-01-01" "1972-01-01" "1973-01-01" "1974-01-01" #> [66] "1975-01-01" "1976-01-01" "1977-01-01" "1978-01-01" "1979-01-01" #> [71] "1980-01-01" "1981-01-01" "1982-01-01" "1983-01-01" "1984-01-01" #> [76] "1985-01-01" "1986-01-01" "1987-01-01" "1988-01-01" "1989-01-01" #> [81] "1990-01-01" "1991-01-01" "1992-01-01" "1993-01-01" "1994-01-01" #> [86] "1995-01-01" "1996-01-01" "1997-01-01" "1998-01-01" "1999-01-01"
t$format(t$breaks(range(years)))
#> [1] "1900" "1920" "1940" "1960" "1980" "2000"