dts | R Documentation |
A function for converting different types of dates into a numerical format.
dts(x, cent, sep, last)
x |
scalar, vector or list with dates to format |
cent |
use centuries? (optional and logical) |
sep |
separator, default " |
last |
take last input value in |
When dating data has a character format like when involving AD, BC, BCE, C.E., etc., or even centuries like Cent., it is many times convenient to convert these type of dating data into a numerical format for a further computation.
In case that the input data has two or more plausible dates, then the outcome by default takes the first value of the input;
otherwise the last date with option last
.
dts
also accepts dates involving centuries with the cent
option.
In this case, it is possible to specify a separator of the century endpoints in sep or use " to
" as the default separator.
For dates having character format, then hyphens are regarded as separators of the plausible dates in x
.
Dating data with a numerical format.
Dating data with unknown year notations produce NA
as output value.
Antonio Rivero Ostoic
plot.dates
, prex
.
# negative first value dts("58 BC - 30 AD") # positive second value dts("58 BC - 30 AD", last=TRUE) # use century notation dts("15th Cent. AD", cent=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.