Skip to content

Commit

Permalink
add validity methods for RD1 and RE1
Browse files Browse the repository at this point in the history
  • Loading branch information
walke committed Sep 20, 2019
1 parent 675c3f1 commit cd5970c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions R/eo1.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,25 @@ setMethod("selectRegion", "RD1", function(x, selectRegion) {
}
)

# validity method
setValidity("RD1",
function(object) {
msg <- NULL
valid <- TRUE

rd1colnames <- c("Year","Region_Code","Region_Name","Age_Name","Total1","Male","Female","D_Total","D_Male","D_Female", "AgeLow")
if (!all(rd1colnames %in% colnames(object@rd1))) {
valid <- FALSE
msg <- c(msg, paste(c("ex1 must contain:",rd1colnames), collapse=" "))
}

if (valid) TRUE else msg
}
)





####
# Class for 'GENESIS-Tabelle: 12411-03-03-4'
Expand Down Expand Up @@ -251,6 +270,24 @@ setMethod("selectRegion", "RE1", function(x, selectRegion) {
}
)

# validity method
setValidity("RE1",
function(object) {
msg <- NULL
valid <- TRUE
re1colnames <-c("Region_Code","Region_Name","Age_Name","Total1","Male","Female","D_Total","D_Male","D_Female",
"A_Total","A_Male","A_Female", "Year", "AgeLow")
if (!all(re1colnames %in% colnames(object@re1))) {
valid <- FALSE
msg <- c(msg, paste(c("ex1 must contain:",re1colnames), collapse=" "))
}

if (valid) TRUE else msg
}
)



####


Expand Down

0 comments on commit cd5970c

Please sign in to comment.