Learn R Programming

MaddisonData (version 1.0.2)

MadDateRanges: Convert a vector of date ranges into a data.frame

Description

MadDateRanges returns a data.frame with 3 numeric columns: yearBegin, yearEnd, and sourceNum from the vector of dateRanges associated with different sources in MaddisonSources.

Usage

MadDateRanges(dateRanges)

Value

a data.frame with 3 columns

yearBegin, yearEnd

numeric years

sourceNum

1, 2, 3, ... for the location in dateRanges

Arguments

dateRanges

character vector of date ranges, each associated with a different source.

Examples

Run this code
MadDateRanges(c('1', '700 – 1500', '1252–1700 (England)', 
      '1915-1919 & 1949', '1820, 1870, 1913, 1950'))
# equal 
data.frame(
yearBegin=c(1,  700, 1252, 1820, 1870, 1913, 1950), 
yearEnd  =c(1, 1500, 1700, 1820, 1870, 1913, 1950), 
sourceNum=c(1, 2, 3, rep(4, 4)))

Run the code above in your browser using DataLab