Skip to content

Commit

Permalink
generate country, content and protocol automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
walke committed Sep 18, 2019
1 parent 835bf88 commit e95702b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/eo1.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}


Expand All @@ -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))
}

####
Expand Down

0 comments on commit e95702b

Please sign in to comment.