dts {sdam} | R Documentation |
Converting dates into a numerical format
Description
A function for converting different types of dates into a numerical format.
Usage
dts(x, cent, sep, last)
Arguments
x |
scalar, vector or list with dates to format |
cent |
use centuries? (optional and logical) |
sep |
separator, default " |
last |
take last input value in |
Details
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, and 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
.
Value
Dating data with a numerical format.
Note
Dating data with unknown year notations produce NA
as output value.
Author(s)
Antonio Rivero Ostoic
See Also
Examples
# 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)