Skip to content

Commit

Permalink
avoid using require()
Browse files Browse the repository at this point in the history
  • Loading branch information
walke committed Oct 2, 2019
1 parent 1469628 commit 1e7408c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions R/GENESISClasses.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Rainer Walke, MPIDR Rostock

require(data.table)

#' @importFrom methods new show validObject
NULL
#' @importFrom data.table :=
Expand Down Expand Up @@ -184,7 +182,7 @@ readRegDeath <- function(infile)
header <- bb[1:h2]
footer <- bb[f1:f2]

rdft <- fread(infile, skip=h2, nrows=(f1-h2-1))
rdft <- data.table::fread(infile, skip=h2, nrows=(f1-h2-1))

setnames(rdft, c("V1","V2","V3","V4","V5","V6","V7","V8","V9","V10"),
c("Year","Region_Code","Region_Name","Age_Name","Total1","Male","Female","D_Total","D_Male","D_Female"))
Expand Down Expand Up @@ -223,7 +221,7 @@ readRegExp <- function(infile)
header <- bb[1:h2]
footer <- bb[f1:f2]

rexpt <- fread(infile, skip=h2, nrows=(f1-h2-1))
rexpt <- data.table::fread(infile, skip=h2, nrows=(f1-h2-1))

setnames(rexpt, c("V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12"),
c("Region_Code","Region_Name","Age_Name","Total1","Male","Female","D_Total","D_Male","D_Female",
Expand Down
6 changes: 2 additions & 4 deletions R/HMDClasses.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Rainer Walke, MPIDR Rostock

require(data.table)

#' @importFrom methods new show validObject
NULL
#' @importFrom data.table :=
Expand Down Expand Up @@ -178,7 +176,7 @@ setValidity("EX1",
readLT1x1 <- function(infile)
{
LT0 <- readLines(infile, n=2)
LT1 <- fread(infile)
LT1 <- data.table::fread(infile)

B1 <- sapply(strsplit(LT0,"[,\t;:]"), trimws)
country <- B1[[1]][1]
Expand All @@ -195,7 +193,7 @@ readLT1x1 <- function(infile)
readEX1x1 <- function(infile)
{
EX0 <- readLines(infile, n=2)
EX1 <- fread(infile)
EX1 <- data.table::fread(infile)

B1 <- sapply(strsplit(EX0,"[,\t;:]"), trimws)
country <- B1[[1]][1]
Expand Down

0 comments on commit 1e7408c

Please sign in to comment.