diff --git a/R/eo1.R b/R/eo1.R index 5e0ba82..6815b86 100644 --- a/R/eo1.R +++ b/R/eo1.R @@ -156,7 +156,13 @@ readLT1x1 <- function(infile) { LT0 <- readLines(infile, n=2) LT1 <- fread(infile) - return(new("LT1", header1=LT0, lt1=LT1, content="Life tables (period 1x1), Females", country="Germany", protocol="v6 (2017)")) + + B1 <- sapply(strsplit(LT0,"[,\t;:]"), trimws) + country <- B1[[1]][1] + content <- paste(B1[[1]][2],B1[[1]][3], sep=", ") + protocol <- B1[[1]][7] + + return(new("LT1", header1=LT0, lt1=LT1, content=content, country=country, protocol=protocol)) } @@ -166,7 +172,13 @@ readEX1x1 <- function(infile) { EX0 <- readLines(infile, n=2) EX1 <- fread(infile) - return(new("EX1", header1=EX0, ex1=EX1, content="Exposure to risk (period 1x1)", country="Germany", protocol="v6 (2017)")) + + B1 <- sapply(strsplit(EX0,"[,\t;:]"), trimws) + country <- B1[[1]][1] + content <- B1[[1]][2] + protocol <- B1[[1]][7] + + return(new("EX1", header1=EX0, ex1=EX1, content=content, country=country, protocol=protocol)) } ####