Title: | Archaeological Time Series |
---|---|
Description: | A toolkit for archaeological time series and time intervals. This package provides a system of classes and methods to represent and work with archaeological time series and time intervals. Dates are represented as "rata die" and can be converted to (virtually) any calendar defined by Reingold and Dershowitz (2018) <doi:10.1017/9781107415058>. This packages offers a simple API that can be used by other specialized packages. |
Authors: | Nicolas Frerebeau [aut, cre] , Joe Roe [aut] , Brice Lebrun [ctb] (<https://orcid.org/0000-0001-7503-8685>, Logo designer), Université Bordeaux Montaigne [fnd], CNRS [fnd] |
Maintainer: | Nicolas Frerebeau <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.3.0 |
Built: | 2024-12-10 11:19:24 UTC |
Source: | https://github.com/tesselle/aion |
Operators performing arithmetic operations.
## S4 method for signature 'RataDie,RataDie' Arith(e1, e2) ## S4 method for signature 'numeric,RataDie' Arith(e1, e2) ## S4 method for signature 'RataDie,numeric' Arith(e1, e2)
## S4 method for signature 'RataDie,RataDie' Arith(e1, e2) ## S4 method for signature 'numeric,RataDie' Arith(e1, e2) ## S4 method for signature 'RataDie,numeric' Arith(e1, e2)
e1 , e2
|
Rata die will be converted to a plain numeric
vector if a computation no
longer makes sense in temporal terms.
A logical
vector.
N. Frerebeau
Other fixed date tools:
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## Vectors of years x <- fixed(c(-350, 31, 1072, 576, 1130), calendar = CE()) y <- fixed(c(1494, 1645, -869, 1440, 1851), calendar = CE()) ## Move forward in time x + y ## Move backward in time x - y ## Not rata die anymore x * y
## Vectors of years x <- fixed(c(-350, 31, 1072, 576, 1130), calendar = CE()) y <- fixed(c(1494, 1645, -869, 1440, 1851), calendar = CE()) ## Move forward in time x + y ## Move backward in time x - y ## Not rata die anymore x * y
Date Conversion from Rata Die
as_date(object, calendar) ## S4 method for signature 'numeric,GregorianCalendar' as_date(object, calendar) ## S4 method for signature 'numeric,JulianCalendar' as_date(object, calendar)
as_date(object, calendar) ## S4 method for signature 'numeric,GregorianCalendar' as_date(object, calendar) ## S4 method for signature 'numeric,JulianCalendar' as_date(object, calendar)
object |
|
calendar |
A |
A numeric
vector of (decimal) years.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Converts a Date to a Decimal of its Year
as_decimal(year, month, day, calendar) ## S4 method for signature 'numeric,numeric,numeric,GregorianCalendar' as_decimal(year, month, day, calendar) ## S4 method for signature 'numeric,numeric,numeric,JulianCalendar' as_decimal(year, month, day, calendar)
as_decimal(year, month, day, calendar) ## S4 method for signature 'numeric,numeric,numeric,GregorianCalendar' as_decimal(year, month, day, calendar) ## S4 method for signature 'numeric,numeric,numeric,JulianCalendar' as_decimal(year, month, day, calendar)
year |
A |
month |
A |
day |
A |
calendar |
A |
A numeric
vector of (ecimal years.
N. Frerebeau
Other fixed date tools:
arithmetic
,
as_date()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Coerce to Rata Die
as_fixed(from) ## S4 method for signature 'numeric' as_fixed(from)
as_fixed(from) ## S4 method for signature 'numeric' as_fixed(from)
from |
A |
A RataDie
object.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Year Conversion from Rata Die
as_year(object, calendar, ...) ## S4 method for signature 'numeric,GregorianCalendar' as_year(object, calendar, decimal = TRUE, ...) ## S4 method for signature 'numeric,JulianCalendar' as_year(object, calendar, decimal = FALSE, ...)
as_year(object, calendar, ...) ## S4 method for signature 'numeric,GregorianCalendar' as_year(object, calendar, decimal = TRUE, ...) ## S4 method for signature 'numeric,JulianCalendar' as_year(object, calendar, decimal = FALSE, ...)
object |
|
calendar |
A |
... |
Currently not used. |
decimal |
A |
A numeric
vector of (decimal) years.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Coerce to a Data Frame
## S4 method for signature 'TimeSeries' as.data.frame(x, ..., calendar = NULL) ## S4 method for signature 'TimeIntervals' as.data.frame(x, ..., calendar = NULL)
## S4 method for signature 'TimeSeries' as.data.frame(x, ..., calendar = NULL) ## S4 method for signature 'TimeIntervals' as.data.frame(x, ..., calendar = NULL)
x |
A |
... |
Further parameters to be passed to |
calendar |
A |
A data.frame
.
as.data.frame(TimeSeries)
: Returns a long data.frame
with the following columns:
time
The (decimal) years at which the time series was sampled.
series
The name of the time series.
variable
The name of the variables.
value
The observed value.
as.data.frame(TimeIntervals)
: Returns a data.frame
with the following columns:
label
The name of the intervals.
start
The start time of the intervals, in (decimal) years.
end
The end time of the intervals, in (decimal) years.
N. Frerebeau
Other mutators:
labels()
,
length()
,
subset()
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
Calendar
calendar(object) ## S4 method for signature 'character' calendar(object)
calendar(object) ## S4 method for signature 'character' calendar(object)
object |
A |
The following time scales are available:
label | era | calendar |
BP |
Before Present | Gregorian |
BC |
Before Christ | Gregorian |
BCE |
Before Common Era | Gregorian |
AD |
Anno Domini | Gregorian |
CE |
Common Era | Gregorian |
b2k |
Years before 2000 | Gregorian |
julian |
Julian | |
A TimeScale
object.
Inspired by era::era()
by Joe Roe.
N. Frerebeau
Other calendar tools:
calendar_get
,
convert()
,
gregorian
,
is()
,
julian()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
Calendar Parameters
calendar_label(object) calendar_name(object) calendar_unit(object) calendar_epoch(object) calendar_fixed(object) calendar_direction(object) calendar_year(object) ## S4 method for signature 'TimeScale' calendar_label(object) ## S4 method for signature 'TimeScale' calendar_name(object) ## S4 method for signature 'TimeScale' calendar_unit(object) ## S4 method for signature 'TimeScale' calendar_epoch(object) ## S4 method for signature 'TimeScale' calendar_fixed(object) ## S4 method for signature 'TimeScale' calendar_direction(object) ## S4 method for signature 'NULL' calendar_direction(object) ## S4 method for signature 'TimeScale' calendar_year(object)
calendar_label(object) calendar_name(object) calendar_unit(object) calendar_epoch(object) calendar_fixed(object) calendar_direction(object) calendar_year(object) ## S4 method for signature 'TimeScale' calendar_label(object) ## S4 method for signature 'TimeScale' calendar_name(object) ## S4 method for signature 'TimeScale' calendar_unit(object) ## S4 method for signature 'TimeScale' calendar_epoch(object) ## S4 method for signature 'TimeScale' calendar_fixed(object) ## S4 method for signature 'TimeScale' calendar_direction(object) ## S4 method for signature 'NULL' calendar_direction(object) ## S4 method for signature 'TimeScale' calendar_year(object)
object |
A |
calendar_label()
returns a character
string giving the
abbreviated label of the time scale.
calendar_name()
returns a character
string giving the name of
the time scale.
calendar_unit()
returns a character
string giving the unit of
the calendar.
calendar_fixed()
returns a length-one numeric
vector giving the
reference date of the calendar (in rata die).
calendar_epoch()
returns a length-one numeric
vector giving the
epoch year from which years are counted (starting date of the calendar,
in years).
calendar_direction()
returns a length-one integer
vector specifying
if years are counted backwards () or forwards (
) from
epoch
. Only the sign of calendar_direction()
is relevant.
calendar_year()
returns a length-one numeric
vector giving the
average length of the year in solar days.
N. Frerebeau
Other calendar tools:
calendar()
,
convert()
,
gregorian
,
is()
,
julian()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
Interconverts dates in a variety of calendars.
convert(from, to, ...) ## S4 method for signature 'character,character' convert(from, to) ## S4 method for signature 'TimeScale,TimeScale' convert(from, to)
convert(from, to, ...) ## S4 method for signature 'character,character' convert(from, to) ## S4 method for signature 'TimeScale,TimeScale' convert(from, to)
from |
A |
to |
A |
... |
Currently not used. |
A function
that when called with a single numeric argument (factional
years) converts years from one calendar to another.
N. Frerebeau
Other calendar tools:
calendar()
,
calendar_get
,
gregorian
,
is()
,
julian()
## Define time scales BP <- calendar("BP") AD <- calendar("AD") ## Make conversion functions BP_to_AD <- convert(BP, AD) AD_to_BP <- convert(AD, BP) ## Convert years BP_to_AD(0) AD_to_BP(1950)
## Define time scales BP <- calendar("BP") AD <- calendar("AD") ## Make conversion functions BP_to_AD <- convert(BP, AD) AD_to_BP <- convert(AD, BP) ## Convert years BP_to_AD(0) AD_to_BP(1950)
A dataset of 33 dates from the years -1000 to 2100 with their equivalents on differents calendars.
dates
dates
A data.frame
with 33 rows and 14 variables:
rata_die
Rata die.
weekday
Week day.
jd
Julian day.
mjd
Modified Julian day.
unix
Unix.
gregorian_year
, gregorian_month
, gregorian_day
Gregorian date.
julian_year
, julian_month
, julian_day
Julian date.
egyptian_year
, egyptian_month
, egyptian_day
Egyptian date.
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Rata Die (Fixed Date)
fixed(year, month, day, calendar, ...) ## S4 method for signature 'numeric,missing,missing,GregorianCalendar' fixed(year, calendar, scale = 1) ## S4 method for signature 'numeric,numeric,numeric,GregorianCalendar' fixed(year, month, day, calendar) ## S4 method for signature 'numeric,missing,missing,JulianCalendar' fixed(year, calendar, scale = 1) ## S4 method for signature 'numeric,numeric,numeric,JulianCalendar' fixed(year, month, day, calendar)
fixed(year, month, day, calendar, ...) ## S4 method for signature 'numeric,missing,missing,GregorianCalendar' fixed(year, calendar, scale = 1) ## S4 method for signature 'numeric,numeric,numeric,GregorianCalendar' fixed(year, month, day, calendar) ## S4 method for signature 'numeric,missing,missing,JulianCalendar' fixed(year, calendar, scale = 1) ## S4 method for signature 'numeric,numeric,numeric,JulianCalendar' fixed(year, month, day, calendar)
year |
A |
month |
A |
day |
A |
calendar |
A |
... |
Currently not used. |
scale |
A length-one |
Rata die are represented as the number of days since 01-01-01 (Gregorian), with negative values for earlier dates.
A RataDie
object.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed_gregorian
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Convenient functions for conversion from and to rata die for a given Gregorian era.
fixed_from_BP(year, month, day) fixed_to_BP(object) fixed_from_BC(year, month, day) fixed_to_BC(object) fixed_from_BCE(year, month, day) fixed_to_BCE(object) fixed_from_AD(year, month, day) fixed_to_AD(object) fixed_from_CE(year, month, day) fixed_to_CE(object) fixed_from_b2k(year, month, day) fixed_to_b2k(object)
fixed_from_BP(year, month, day) fixed_to_BP(object) fixed_from_BC(year, month, day) fixed_to_BC(object) fixed_from_BCE(year, month, day) fixed_to_BCE(object) fixed_from_AD(year, month, day) fixed_to_AD(object) fixed_from_CE(year, month, day) fixed_to_CE(object) fixed_from_b2k(year, month, day) fixed_to_b2k(object)
year |
A |
month |
A |
day |
A |
object |
The astronomical notation is used for Gregorian years (there is a year 0).
fixed_from_*()
returns a RataDie
object.
fixed_to_*()
returns a numeric
vector of Gregorian years.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_julian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Convenient functions for conversion from and to rata die.
fixed_from_julian(year, month, day) fixed_to_julian(object)
fixed_from_julian(year, month, day) fixed_to_julian(object)
year |
A |
month |
A |
day |
A |
object |
fixed_from_julian()
returns a RataDie
object.
fixed_to_julian()
returns a numeric
vector of Julian years.
N. Frerebeau
Reingold, E. M. and Dershowitz, N. (2018). Calendrical Calculations: The Ultimate Edition. Cambridge University Press. doi:10.1017/9781107415058.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
format()
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Date Conversion to Character
## S4 method for signature 'TimeScale' format(x, ...) ## S4 method for signature 'RataDie' format( x, prefix = c("a", "ka", "Ma", "Ga"), label = TRUE, calendar = getOption("aion.calendar"), ... )
## S4 method for signature 'TimeScale' format(x, ...) ## S4 method for signature 'RataDie' format( x, prefix = c("a", "ka", "Ma", "Ga"), label = TRUE, calendar = getOption("aion.calendar"), ... )
x |
A |
... |
Currently not used. |
prefix |
A |
label |
A |
calendar |
A |
A character
vector representing the date.
N. Frerebeau
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
pretty()
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
## R 1.0.0 (y <- fixed(year = 2000, month = 02, day = 29, calendar = CE())) as_date(y, calendar = CE()) as_year(y, calendar = CE()) ## Create a vector of years BP (Gregorian) ## (every two years starting from 2000 BP) (years <- seq(from = 2000, by = -2, length.out = 10)) ## Convert years to rata die (rd <- fixed(years, calendar = BP())) ## Convert back to Gregorian years BP as_year(rd, calendar = BP()) ## More convenient (rd <- fixed_from_BP(years)) fixed_to_BP(rd)
Gregorian Calendar
BP(...) b2k(...) BC(...) BCE(...) AD(...) CE(...)
BP(...) b2k(...) BC(...) BCE(...) AD(...) CE(...)
... |
Currently not used. |
A GregorianCalendar
object.
N. Frerebeau
Other calendar tools:
calendar()
,
calendar_get
,
convert()
,
is()
,
julian()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
Heat Map
## S4 method for signature 'TimeSeries' image(x, calendar = getOption("aion.calendar"), k = 1, ...)
## S4 method for signature 'TimeSeries' image(x, calendar = getOption("aion.calendar"), k = 1, ...)
x |
A |
calendar |
A |
k |
An |
... |
Further parameters to be passed to |
image()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
N. Frerebeau
Other plotting tools:
plot()
,
year_axis()
## Create 6 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = matrix(rnorm(300), nrow = 50, ncol = 6), time = seq(2000, by = -2, length.out = 50), calendar = BP() ) ## Image image(X, calendar = CE())
## Create 6 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = matrix(rnorm(300), nrow = 50, ncol = 6), time = seq(2000, by = -2, length.out = 50), calendar = BP() ) ## Image image(X, calendar = CE())
An Interval is elapsed time in seconds between two specific years.
intervals(start, end, calendar, ...) ## S4 method for signature 'RataDie,RataDie,missing' intervals(start, end, names = NULL) ## S4 method for signature 'numeric,numeric,TimeScale' intervals(start, end, calendar, scale = 1, names = NULL)
intervals(start, end, calendar, ...) ## S4 method for signature 'RataDie,RataDie,missing' intervals(start, end, names = NULL) ## S4 method for signature 'numeric,numeric,TimeScale' intervals(start, end, calendar, scale = 1, names = NULL)
start |
A |
end |
A |
calendar |
A |
... |
Currently not used. |
names |
A |
scale |
A length-one |
A TimeIntervals
object.
N. Frerebeau
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Plot intervals plot(int) # Default calendar ## Overlap overlap(int, calendar = CE())
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Plot intervals plot(int) # Default calendar ## Overlap overlap(int, calendar = CE())
Test inheritance relationships between an object and a calendar class.
is_gregorian(object) is_julian(object) ## S4 method for signature 'ANY' is_gregorian(object) ## S4 method for signature 'ANY' is_julian(object)
is_gregorian(object) is_julian(object) ## S4 method for signature 'ANY' is_gregorian(object) ## S4 method for signature 'ANY' is_julian(object)
object |
Any R object. |
A logical
vector.
N. Frerebeau
Other calendar tools:
calendar()
,
calendar_get
,
convert()
,
gregorian
,
julian()
Julian Calendar
J(...)
J(...)
... |
Currently not used. |
A JulianCalendar
object.
N. Frerebeau
Other calendar tools:
calendar()
,
calendar_get
,
convert()
,
gregorian
,
is()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
## Define time scales calendar("BP") calendar("AD") calendar("julian") ## Shortcuts BP() AD() J()
Find a suitable set of labels from an object.
## S4 method for signature 'TimeSeries' labels(object, ...) ## S4 method for signature 'TimeIntervals' labels(object, ...)
## S4 method for signature 'TimeSeries' labels(object, ...) ## S4 method for signature 'TimeIntervals' labels(object, ...)
object |
An R object. |
... |
Currently not used. |
A character
vector.
N. Frerebeau
Other mutators:
as.data.frame()
,
length()
,
subset()
Get the length of an object.
## S4 method for signature 'TimeIntervals' length(x)
## S4 method for signature 'TimeIntervals' length(x)
x |
An R object. |
A length-one integer
vector.
N. Frerebeau
Other mutators:
as.data.frame()
,
labels()
,
subset()
Computes the length of overlap of time intervals.
overlap(x, ...) ## S4 method for signature 'TimeIntervals' overlap(x, calendar = NULL)
overlap(x, ...) ## S4 method for signature 'TimeIntervals' overlap(x, calendar = NULL)
x |
A |
... |
Currently not used. |
calendar |
A |
The overlap of two time intervals is a difference between the minimum value of the two upper boundaries and the maximum value of the two lower boundaries, plus 1.
A symmetric numeric
matrix
of years.
N. Frerebeau
Other tools:
span()
,
start()
,
time()
,
window()
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Plot intervals plot(int) # Default calendar ## Overlap overlap(int, calendar = CE())
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Plot intervals plot(int) # Default calendar ## Overlap overlap(int, calendar = CE())
Plot Time Series and Time Intervals
## S4 method for signature 'TimeIntervals,missing' plot( x, calendar = getOption("aion.calendar"), sort = TRUE, decreasing = FALSE, xlab = NULL, ylab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'TimeSeries,missing' plot( x, facet = c("multiple", "single"), calendar = getOption("aion.calendar"), panel = graphics::lines, flip = FALSE, ncol = NULL, xlab = NULL, ylab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
## S4 method for signature 'TimeIntervals,missing' plot( x, calendar = getOption("aion.calendar"), sort = TRUE, decreasing = FALSE, xlab = NULL, ylab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'TimeSeries,missing' plot( x, facet = c("multiple", "single"), calendar = getOption("aion.calendar"), panel = graphics::lines, flip = FALSE, ncol = NULL, xlab = NULL, ylab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
x |
A |
calendar |
A |
sort |
A |
decreasing |
A |
xlab , ylab
|
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An |
panel.last |
An |
... |
Further parameters to be passed to |
facet |
A |
panel |
A |
flip |
A |
ncol |
An |
plot()
is called for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
N. Frerebeau
Other plotting tools:
image()
,
year_axis()
## Create 6 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = matrix(rnorm(300), nrow = 50, ncol = 6), time = seq(2000, by = -2, length.out = 50), calendar = BP() ) ## Multiple plot(X) # Default calendar plot(X, calendar = BP(), flip = TRUE) # BP plot(X, calendar = b2k(), ncol = 1) # b2k ## Single plot(X, facet = "single") # CE plot(X, facet = "single", calendar = BP()) # BP ## Create 6 x 3 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = array(rnorm(900), dim = c(50, 6, 3)), time = seq(2000, by = 2, length.out = 50), calendar = BP() ) plot(X, calendar = BP(), flip = TRUE) # BP plot(X, calendar = b2k(), ncol = 1) # b2k ## Graphical parameters plot(X, lwd = c(1, 2, 3), col = c("#004488", "#DDAA33", "#BB5566")) plot(X, type = "b", pch = 16, col = c("#004488", "#DDAA33", "#BB5566")) plot(X, type = "p", pch = c(16, 17, 18), cex = c(1, 2, 3))
## Create 6 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = matrix(rnorm(300), nrow = 50, ncol = 6), time = seq(2000, by = -2, length.out = 50), calendar = BP() ) ## Multiple plot(X) # Default calendar plot(X, calendar = BP(), flip = TRUE) # BP plot(X, calendar = b2k(), ncol = 1) # b2k ## Single plot(X, facet = "single") # CE plot(X, facet = "single", calendar = BP()) # BP ## Create 6 x 3 time-series of 50 observations ## Sampled every two years starting from 2000 BP X <- series( object = array(rnorm(900), dim = c(50, 6, 3)), time = seq(2000, by = 2, length.out = 50), calendar = BP() ) plot(X, calendar = BP(), flip = TRUE) # BP plot(X, calendar = b2k(), ncol = 1) # b2k ## Graphical parameters plot(X, lwd = c(1, 2, 3), col = c("#004488", "#DDAA33", "#BB5566")) plot(X, type = "b", pch = 16, col = c("#004488", "#DDAA33", "#BB5566")) plot(X, type = "p", pch = c(16, 17, 18), cex = c(1, 2, 3))
Pretty Breakpoints
## S4 method for signature 'RataDie' pretty(x, calendar = getOption("aion.calendar"), ...)
## S4 method for signature 'RataDie' pretty(x, calendar = getOption("aion.calendar"), ...)
x |
A |
calendar |
A |
... |
Further parameters to be passed to |
pretty()
computes a vector of increasing numbers which are "pretty" in
decimal notation of calendar
. Pretty breakpoints are then converted to
rata die.
A RataDie
object.
Other fixed date tools:
arithmetic
,
as_date()
,
as_decimal()
,
as_fixed()
,
as_year()
,
fixed()
,
fixed_gregorian
,
fixed_julian
,
format()
An S4 class to represent a vector of rata die.
Rata die (fixed date) are represented as the number of days since 01-01-01 (Gregorian), with negative values for earlier dates.
It is intended that the date should be an integer value, but this is not enforced in the internal representation.
.Data
A numeric
vector giving the rata die values.
This class inherits from numeric
.
N. Frerebeau
Other classes:
GregorianCalendar-class
,
JulianCalendar-class
,
TimeIntervals-class
,
TimeScale-class
,
TimeSeries-class
Other time classes:
TimeIntervals-class
,
TimeSeries-class
Create Time Series
series(object, time, calendar, ...) ## S4 method for signature 'array,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'array,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'matrix,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'matrix,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'numeric,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'numeric,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'data.frame,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'data.frame,RataDie,missing' series(object, time, names = NULL)
series(object, time, calendar, ...) ## S4 method for signature 'array,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'array,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'matrix,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'matrix,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'numeric,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'numeric,RataDie,missing' series(object, time, names = NULL) ## S4 method for signature 'data.frame,numeric,TimeScale' series(object, time, calendar, scale = 1, names = NULL) ## S4 method for signature 'data.frame,RataDie,missing' series(object, time, names = NULL)
object |
A |
time |
A |
calendar |
A |
... |
Currently not used. |
names |
A |
scale |
A length-one |
Data will be sorted in chronological order.
A TimeSeries
object.
N. Frerebeau
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
Get the duration of time series or intervals.
span(x, ...) ## S4 method for signature 'TimeSeries' span(x, calendar = NULL) ## S4 method for signature 'TimeIntervals' span(x, calendar = NULL)
span(x, ...) ## S4 method for signature 'TimeSeries' span(x, calendar = NULL) ## S4 method for signature 'TimeIntervals' span(x, calendar = NULL)
x |
A |
... |
Currently not used. |
calendar |
A |
A numeric
vector of years.
N. Frerebeau
Other tools:
overlap()
,
start()
,
time()
,
window()
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Get time durations span(int, calendar = CE())
## Create time intervals int <- intervals( start = c(625, 700, 1200, 1225, 1250, 500, 1000, 1200, 1325, 1375, 1200, 1300, 1375, 1275, 1325), end = c(750, 825, 1250, 1275, 1325, 700, 1300, 1325, 1400, 1500, 1300, 1375, 1500, 1325, 1425), calendar = CE() ) ## Get time durations span(int, calendar = CE())
Get the times the first and last observations were taken.
## S4 method for signature 'TimeSeries' start(x, calendar = NULL, ...) ## S4 method for signature 'TimeIntervals' start(x, calendar = NULL, ...) ## S4 method for signature 'TimeSeries' end(x, calendar = NULL, ...) ## S4 method for signature 'TimeIntervals' end(x, calendar = NULL, ...)
## S4 method for signature 'TimeSeries' start(x, calendar = NULL, ...) ## S4 method for signature 'TimeIntervals' start(x, calendar = NULL, ...) ## S4 method for signature 'TimeSeries' end(x, calendar = NULL, ...) ## S4 method for signature 'TimeIntervals' end(x, calendar = NULL, ...)
x |
A |
calendar |
A |
... |
Currently not used. |
A numeric
vector of decimal years (if calendar
is not NULL
).
N. Frerebeau
Other tools:
overlap()
,
span()
,
time()
,
window()
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
Operators acting on objects to extract or replace parts.
## S4 method for signature 'RataDie' x[i] ## S4 method for signature 'TimeIntervals' x[i] ## S4 method for signature 'TimeSeries' x[i, j, k, drop = FALSE]
## S4 method for signature 'RataDie' x[i] ## S4 method for signature 'TimeIntervals' x[i] ## S4 method for signature 'TimeSeries' x[i, j, k, drop = FALSE]
x |
An object from which to extract element(s) or in which to replace element(s). |
i , j , k
|
Indices specifying elements to extract or replace. |
drop |
A |
A subsetted object.
N. Frerebeau
Other mutators:
as.data.frame()
,
labels()
,
length()
Get the sampling times:
time()
creates the vector of times at which a time series was sampled.
frequency()
returns the mean number of samples per unit time.
## S4 method for signature 'TimeSeries' time(x, calendar = NULL, ...) ## S4 method for signature 'TimeSeries' frequency(x, ...)
## S4 method for signature 'TimeSeries' time(x, calendar = NULL, ...) ## S4 method for signature 'TimeSeries' frequency(x, ...)
x |
A |
calendar |
A |
... |
Currently not used. |
A numeric
vector of decimal years (if calendar
is not NULL
).
N. Frerebeau
Other tools:
overlap()
,
span()
,
start()
,
window()
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
## Create time-series of 20 observations ## Univariate ## Sampled every years starting from 1029 BCE (X <- series(rnorm(30), time = 1029:1000, calendar = BCE())) ## Terminal and sampling times (returns rata die) start(X) end(X) time(X) span(X) ## Multivariate ## Sampled every century starting from 1000 CE (Y <- series(matrix(rnorm(90), 30, 3), time = 1000:1029, calendar = CE())) ## Terminal and sampling times (returns Gregorian Common Era years) start(Y, calendar = CE()) end(Y, calendar = CE()) time(Y, calendar = CE()) span(Y, calendar = CE()) ## Coerce to data frame df <- as.data.frame(Y, calendar = BP()) head(df)
An S4 class to represent time intervals.
.Id
A character
vector specifying the identifier/name of intervals.
Duplicated values are interpreted as disjoint intervals referring to the
same event.
.Start
A RataDie
object giving the start time of the
intervals.
.End
A RataDie
object giving the end time of the intervals.
N. Frerebeau
Other classes:
GregorianCalendar-class
,
JulianCalendar-class
,
RataDie-class
,
TimeScale-class
,
TimeSeries-class
Other time classes:
RataDie-class
,
TimeSeries-class
A virtual S4 class to represent a calendar.
label
A character
string specifying the abbreviated label of
the time scale.
name
A character
string specifying the name of the time scale.
epoch
A numeric
value specifying the epoch year from which
years are counted (starting date of the calendar, in years). Allows to
define multiple era of a calendar.
fixed
A numeric
value specifying the reference date of the calendar
(in rata die).
direction
An integer
specifying if years are counted backwards
(-1
) or forwards (1
) from epoch
.
year
A numeric
value giving the average length of the year in
solar days.
N. Frerebeau
Other classes:
GregorianCalendar-class
,
JulianCalendar-class
,
RataDie-class
,
TimeIntervals-class
,
TimeSeries-class
Other calendar classes:
GregorianCalendar-class
,
JulianCalendar-class
An S4 class to represent time series.
A time series object is an array, with
being the number of observations,
being the number of series
and with the
columns of the third dimension containing extra
variables for each series.
This class inherits from array
.
N. Frerebeau
Other classes:
GregorianCalendar-class
,
JulianCalendar-class
,
RataDie-class
,
TimeIntervals-class
,
TimeScale-class
Other time classes:
RataDie-class
,
TimeIntervals-class
Extracts the subset of the object x
observed between the times start
and
end
(expressed in rata die).
## S4 method for signature 'TimeSeries' window(x, start = NULL, end = NULL, ...)
## S4 method for signature 'TimeSeries' window(x, start = NULL, end = NULL, ...)
x |
A |
start |
A length-one |
end |
A length-one |
... |
Currently not used. |
A TimeSeries
object.
N. Frerebeau
Other tools:
overlap()
,
span()
,
start()
,
time()
## Create 3 time-series of 100 observations ## Sampled every years starting from 1000 CE (x <- series(matrix(rnorm(300), 100, 3), time = 1000:1099, calendar = CE())) ## Subset between 1025 and 1050 CE (y <- window(x, start = 374009, end = 383140))
## Create 3 time-series of 100 observations ## Sampled every years starting from 1000 CE (x <- series(matrix(rnorm(300), 100, 3), time = 1000:1099, calendar = CE())) ## Subset between 1025 and 1050 CE (y <- window(x, start = 374009, end = 383140))
Time Series Plotting Functions
year_axis( side, at = NULL, format = c("a", "ka", "Ma", "Ga"), labels = TRUE, calendar = getOption("aion.last_calendar"), current_calendar = getOption("aion.last_calendar"), ... )
year_axis( side, at = NULL, format = c("a", "ka", "Ma", "Ga"), labels = TRUE, calendar = getOption("aion.last_calendar"), current_calendar = getOption("aion.last_calendar"), ... )
side |
An |
at |
A |
format |
A |
labels |
A |
calendar |
A |
current_calendar |
A |
... |
Further parameters to be passed to |
year_axis()
is called it for its side-effects.
N. Frerebeau
Other plotting tools:
image()
,
plot()
## Create a time-series of 300 observations ## Sampled every two years starting from 2000 BP X <- series( object = rnorm(300), time = seq(2000, by = -2, length.out = 300), calendar = BP() ) ## Axis plot(X, axes = FALSE, calendar = BP()) # Remove axes year_axis(side = 1) # Same calendar as last plot year_axis(side = 3, calendar = CE()) # Specific calendar mtext(format(CE()), side = 3, line = 3) ## Grid plot(X, panel.first = graphics::grid())
## Create a time-series of 300 observations ## Sampled every two years starting from 2000 BP X <- series( object = rnorm(300), time = seq(2000, by = -2, length.out = 300), calendar = BP() ) ## Axis plot(X, axes = FALSE, calendar = BP()) # Remove axes year_axis(side = 1) # Same calendar as last plot year_axis(side = 3, calendar = CE()) # Specific calendar mtext(format(CE()), side = 3, line = 3) ## Grid plot(X, panel.first = graphics::grid())