| 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] (ORCID: <https://orcid.org/0000-0001-5759-4944>), Joe Roe [aut] (ORCID: <https://orcid.org/0000-0002-1011-1244>), Brice Lebrun [art] (ORCID: <https://orcid.org/0000-0001-7503-8685>, Logo designer), Université Bordeaux Montaigne [fnd] (ROR: <https://ror.org/03pbgwk21>), CNRS [fnd] (ROR: <https://ror.org/02feahw73>) |
| Maintainer: | Nicolas Frerebeau <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.7.0.9000 |
| Built: | 2026-06-03 07:55:06 UTC |
| Source: | https://codeberg.org/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:
timeThe sampling times. If calendar is not NULL, it is
expressed in decimal years; otherwise, it is expressed in rata die.
seriesThe name of the time series.
variableThe name of the variables.
valueThe observed value.
as.data.frame(TimeIntervals): Returns a data.frame with the following columns:
labelThe name of the intervals.
startThe start time of the intervals. If calendar is not
NULL, it is expressed in decimal years; otherwise, it is expressed in
rata die.
endThe end time of the intervals. If calendar is not NULL, it
is expressed in decimal years; otherwise, it is expressed in rata die.
N. Frerebeau
Other mutators:
flip(),
labels(),
length,
names,
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(),
get_calendar(),
gregorian,
is_calendar(),
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(),
get_calendar(),
gregorian,
is_calendar(),
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,
get_calendar(),
gregorian,
is_calendar(),
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.
datesdates
A data.frame with 33 rows and 14 variables:
rata_dieRata die.
weekdayWeek day.
jdJulian day.
mjdModified Julian day.
unixUnix.
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)
Transposes a time series object by permuting its dimensions and resizing it.
flip(x, ...) ## S4 method for signature 'TimeSeries' flip(x)flip(x, ...) ## S4 method for signature 'TimeSeries' flip(x)
x |
A |
... |
Currently not used. |
A permuted () TimeSeries object.
N. Frerebeau
Other mutators:
as.data.frame(),
labels(),
length,
names,
subset
## 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()) ## Permute dimensions 2 and 3 ## 3 x 6 time-series of 50 observations Y <- flip(X) plot(Y, calendar = 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()) ## Permute dimensions 2 and 3 ## 3 x 6 time-series of 50 observations Y <- flip(X) plot(Y, calendar = BP())
Date Conversion to Character
## S4 method for signature 'TimeIntervals' format(x, calendar = get_calendar(), ...) ## S4 method for signature 'TimeScale' format(x, ...) ## S4 method for signature 'RataDie' format( x, prefix = c("a", "ka", "Ma", "Ga"), label = TRUE, calendar = get_calendar(), ... )## S4 method for signature 'TimeIntervals' format(x, calendar = get_calendar(), ...) ## S4 method for signature 'TimeScale' format(x, ...) ## S4 method for signature 'RataDie' format( x, prefix = c("a", "ka", "Ma", "Ga"), label = TRUE, calendar = get_calendar(), ... )
x |
A |
calendar |
A |
... |
Currently not used. |
prefix |
A |
label |
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)
Get or Set the Default Calendar
get_calendar(which = c("default", "current")) set_calendar(x, which = c("default", "current"))get_calendar(which = c("default", "current")) set_calendar(x, which = c("default", "current"))
which |
A |
x |
A |
A TimeScale object.
N. Frerebeau
Other calendar tools:
calendar(),
calendar_get,
convert(),
gregorian,
is_calendar(),
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()
Creates an interval or a stratigraphic graph.
graph_create(object, ...) ## S4 method for signature 'data.frame' graph_create( object, type = c("interval", "stratigraphy"), direction = c("above", "below"), verbose = getOption("aion.verbose"), ... ) ## S4 method for signature 'matrix' graph_create( object, type = c("interval", "stratigraphy"), direction = c("above", "below"), verbose = getOption("aion.verbose"), ... ) ## S4 method for signature 'TimeIntervals' graph_create( object, type = c("interval", "stratigraphy"), verbose = getOption("aion.verbose"), ... )graph_create(object, ...) ## S4 method for signature 'data.frame' graph_create( object, type = c("interval", "stratigraphy"), direction = c("above", "below"), verbose = getOption("aion.verbose"), ... ) ## S4 method for signature 'matrix' graph_create( object, type = c("interval", "stratigraphy"), direction = c("above", "below"), verbose = getOption("aion.verbose"), ... ) ## S4 method for signature 'TimeIntervals' graph_create( object, type = c("interval", "stratigraphy"), verbose = getOption("aion.verbose"), ... )
object |
A |
... |
Currently not used. |
type |
A |
direction |
A |
verbose |
A |
intervalAn interval graph is the graph showing intersecting intervals on a line. As time is linear and not circular, an interval graph contains no cycles with more than three edges and no shortcuts (it must be a chordal graph).
stratigraphyA stratigraphic graph represents the directed relationships between temporal units (archaeological deposits), from the most recent to the oldest (Harris 1997). It can be formally defined as a directed acyclic graph (DAG), in which each vertex represents a layer and the edges represent stratigraphic relations.
An igraph graph object.
Experimental.
The igraph and relations packages need to be installed on your machine.
N. Frerebeau
Harris, Edward C., 1997. Principles of Archaeological Stratigraphy. Seconde edition. Academic Press.
Other graph tools:
graph_prune()
if (requireNamespace("igraph", quietly = TRUE) && requireNamespace("relations", quietly = TRUE)) { ## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Interval graph g <- graph_create(int, type = "interval") plot(g) ## Stratigraphic graph g <- graph_create(int, type = "strati") g <- graph_prune(g) # Remove redundant relations plot(g, layout = igraph::layout_with_sugiyama) }if (requireNamespace("igraph", quietly = TRUE) && requireNamespace("relations", quietly = TRUE)) { ## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Interval graph g <- graph_create(int, type = "interval") plot(g) ## Stratigraphic graph g <- graph_create(int, type = "strati") g <- graph_prune(g) # Remove redundant relations plot(g, layout = igraph::layout_with_sugiyama) }
Removes redundant relations from a graph.
graph_prune(object, ...) ## S4 method for signature 'igraph' graph_prune( object, reduce = TRUE, remove_multiple = TRUE, remove_loops = TRUE, ... )graph_prune(object, ...) ## S4 method for signature 'igraph' graph_prune( object, reduce = TRUE, remove_multiple = TRUE, remove_loops = TRUE, ... )
object |
An igraph object (typically returned by
|
... |
Currently not used. |
reduce |
A |
remove_multiple |
A |
remove_loops |
A |
An igraph graph object.
Experimental.
The igraph and relations packages need to be installed on your machine.
N. Frerebeau
Other graph tools:
graph_create()
if (requireNamespace("igraph", quietly = TRUE) && requireNamespace("relations", quietly = TRUE)) { ## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Interval graph g <- graph_create(int, type = "interval") plot(g) ## Stratigraphic graph g <- graph_create(int, type = "strati") g <- graph_prune(g) # Remove redundant relations plot(g, layout = igraph::layout_with_sugiyama) }if (requireNamespace("igraph", quietly = TRUE) && requireNamespace("relations", quietly = TRUE)) { ## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Interval graph g <- graph_create(int, type = "interval") plot(g) ## Stratigraphic graph g <- graph_create(int, type = "strati") g <- graph_prune(g) # Remove redundant relations plot(g, layout = igraph::layout_with_sugiyama) }
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(),
get_calendar(),
is_calendar(),
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 = get_calendar(), k = 1, ...)## S4 method for signature 'TimeSeries' image(x, calendar = get_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_calendar(object) is_gregorian(object) is_julian(object)is_calendar(object) is_gregorian(object) is_julian(object)
object |
Any R object. |
A logical scalar.
N. Frerebeau
Other calendar tools:
calendar(),
calendar_get,
convert(),
get_calendar(),
gregorian,
julian
Julian Calendar
J(...)J(...)
... |
Currently not used. |
A JulianCalendar object.
N. Frerebeau
Other calendar tools:
calendar(),
calendar_get,
convert(),
get_calendar(),
gregorian,
is_calendar()
## 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(),
flip(),
length,
names,
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(),
flip(),
labels(),
names,
subset
Get or set the names of an object.
## S4 method for signature 'TimeIntervals' names(x) ## S4 replacement method for signature 'TimeIntervals' names(x) <- value## S4 method for signature 'TimeIntervals' names(x) ## S4 replacement method for signature 'TimeIntervals' names(x) <- value
x |
An R object. |
value |
A |
The updated object.
N. Frerebeau
Other mutators:
as.data.frame(),
flip(),
labels(),
length,
subset
Computes the length of overlap of time intervals.
overlap(x, ...) ## S4 method for signature 'TimeIntervals' overlap(x, calendar = NULL, aggregate = TRUE)overlap(x, ...) ## S4 method for signature 'TimeIntervals' overlap(x, calendar = NULL, aggregate = TRUE)
x |
A |
... |
Currently not used. |
calendar |
A |
aggregate |
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 temporal relations:
relations
## 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 = get_calendar(), groups = NULL, 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 = get_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 = get_calendar(), groups = NULL, 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 = get_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 |
groups |
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 = get_calendar(), ...)## S4 method for signature 'RataDie' pretty(x, calendar = get_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.
.DataA 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
Test for the logical relation between time intervals according to Allen's typology.
precedes(x, ...) preceded_by(x, ...) meets(x, ...) met_by(x, ...) overlaps(x, ...) overlapped_by(x, ...) finishes(x, ...) finished_by(x, ...) contains(x, ...) during(x, ...) starts(x, ...) started_by(x, ...) equals(x, ...) ## S4 method for signature 'TimeIntervals' precedes(x, ...) ## S4 method for signature 'TimeIntervals' preceded_by(x, ...) ## S4 method for signature 'TimeIntervals' meets(x, ...) ## S4 method for signature 'TimeIntervals' met_by(x, ...) ## S4 method for signature 'TimeIntervals' overlaps(x, ...) ## S4 method for signature 'TimeIntervals' overlapped_by(x, ...) ## S4 method for signature 'TimeIntervals' finishes(x, ...) ## S4 method for signature 'TimeIntervals' finished_by(x, ...) ## S4 method for signature 'TimeIntervals' contains(x, ...) ## S4 method for signature 'TimeIntervals' during(x, ...) ## S4 method for signature 'TimeIntervals' starts(x, ...) ## S4 method for signature 'TimeIntervals' started_by(x, ...) ## S4 method for signature 'TimeIntervals' equals(x, ...)precedes(x, ...) preceded_by(x, ...) meets(x, ...) met_by(x, ...) overlaps(x, ...) overlapped_by(x, ...) finishes(x, ...) finished_by(x, ...) contains(x, ...) during(x, ...) starts(x, ...) started_by(x, ...) equals(x, ...) ## S4 method for signature 'TimeIntervals' precedes(x, ...) ## S4 method for signature 'TimeIntervals' preceded_by(x, ...) ## S4 method for signature 'TimeIntervals' meets(x, ...) ## S4 method for signature 'TimeIntervals' met_by(x, ...) ## S4 method for signature 'TimeIntervals' overlaps(x, ...) ## S4 method for signature 'TimeIntervals' overlapped_by(x, ...) ## S4 method for signature 'TimeIntervals' finishes(x, ...) ## S4 method for signature 'TimeIntervals' finished_by(x, ...) ## S4 method for signature 'TimeIntervals' contains(x, ...) ## S4 method for signature 'TimeIntervals' during(x, ...) ## S4 method for signature 'TimeIntervals' starts(x, ...) ## S4 method for signature 'TimeIntervals' started_by(x, ...) ## S4 method for signature 'TimeIntervals' equals(x, ...)
x |
A |
... |
Currently not used. |
Allen (1983) proposed thirteen basic relations between time intervals that are (Alspaugh 2019):
Distinct: no pair of definite intervals can be related by more than one of the relationships.
Exhaustive: any pair of definite intervals are described by one of the relations.
Qualitative: no numeric time spans are considered.
| Relation | Converse | ||
| precedes | (p) | (P) | preceded by |
| meets | (m) | (M) | met by |
| overlaps | (o) | (O) | overlapped by |
| finished by | (F) | (f) | finishes |
| contains | (D) | (d) | during |
| starts | (s) | (S) | started by |
| equals | (e) |
A precedes B
A === B ===
A preceded by B
A === B ===
A meets B
A === B ===
A met by B
A === B ===
A overlaps B
A === B ===
A overlapped by B
A === B ===
A finished by B
A ===== B ===
A finishes B
A === B =====
A contains B
A ===== B ===
A during B
A === B =====
A starts B
A === B =====
A started by B
A ===== B ===
A equals B
A === B ===
A two-columns matrix where each row specifies one relation.
N. Frerebeau
Allen, J. F. (1983). Maintaining Knowledge about Temporal Intervals. Communications of the ACM, 26(11): 832-843. doi:10.1145/182.358434.
Alspaugh, T. (2019). Allen's Interval Algebra. URL: https://thomasalspaugh.org/pub/fnd/allen.html.
Other temporal relations:
overlap()
## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Plot intervals plot(int) ## Temporal relations precedes(int) # A precedes E... overlaps(int) # A overlaps C... contains(int) # A contains B...## Seven intervals int <- intervals( start = c(1, 2, 3, 6, 9, 13, 17), end = c(7, 4, 15, 14, 11, 18, 19), calendar = CE(), names = c("A", "B", "C", "D", "E", "F", "G") ) ## Plot intervals plot(int) ## Temporal relations precedes(int) # A precedes E... overlaps(int) # A overlaps C... contains(int) # A contains B...
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:
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:
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(),
flip(),
labels(),
length,
names
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:
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.
.IdA character vector specifying the identifier/name of intervals.
Duplicated values are interpreted as disjoint intervals referring to the
same event.
.StartA RataDie object giving the start time of the
intervals.
.EndA 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.
labelA character string specifying the abbreviated label of
the time scale.
nameA character string specifying the name of the time scale.
epochA 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.
fixedA numeric value specifying the reference date of the calendar
(in rata die).
directionAn integer specifying if years are counted backwards
(-1) or forwards (1) from epoch.
yearA 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:
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 = get_calendar("current"), current_calendar = get_calendar("current"), ... )year_axis( side, at = NULL, format = c("a", "ka", "Ma", "Ga"), labels = TRUE, calendar = get_calendar("current"), current_calendar = get_calendar("current"), ... )
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())