Commit 2ebe9c3e authored by GNajeral's avatar GNajeral

valid variables local values not duplicated

parent 33c6af54
...@@ -51,7 +51,7 @@ file_name <- readline("Introduce the name of the file to check the values: ") ...@@ -51,7 +51,7 @@ file_name <- readline("Introduce the name of the file to check the values: ")
harmonized_data <- "" harmonized_data <- ""
if (grepl(".csv" , file_name , fixed = TRUE)){ if (grepl(".csv" , file_name , fixed = TRUE)){
harmonized_data <- read.csv(file_name , sep = ";") harmonized_data <- read.csv(file_name)
}else if (grepl(".xlsx" , file_name , fixed = TRUE)){ }else if (grepl(".xlsx" , file_name , fixed = TRUE)){
harmonized_data <- read.xlsx(file_name) harmonized_data <- read.xlsx(file_name)
} }
...@@ -306,7 +306,7 @@ check_valid_values <- function(valid_colnames, codebook_param){ ...@@ -306,7 +306,7 @@ check_valid_values <- function(valid_colnames, codebook_param){
} }
#if("DMRBORN" == name | grepl("DAT", name, fixed=TRUE) | grepl("ISO", name , fixed=TRUE) | grepl("BEF", name, fixed=TRUE)){ #if("DMRBORN" == name | grepl("DAT", name, fixed=TRUE) | grepl("ISO", name , fixed=TRUE) | grepl("BEF", name, fixed=TRUE)){
# next # next
#} #}
column <- valid_colnames[,i] column <- valid_colnames[,i]
...@@ -315,10 +315,10 @@ check_valid_values <- function(valid_colnames, codebook_param){ ...@@ -315,10 +315,10 @@ check_valid_values <- function(valid_colnames, codebook_param){
column_type <- codebook_param$Variable.type[codebook_param$Harmonised.variable.name == name] column_type <- codebook_param$Variable.type[codebook_param$Harmonised.variable.name == name]
if (is.na(column_type) ) { if (is.na(column_type) ) {
variable <- paste("Variable ", name, " wrong", sep = " ") variable <- paste("Variable ", name, " wrong", sep = " ")
res <- paste(res, variable , sep="\n") res <- paste(res, variable , sep="\n")
next next
} }
result = switch( result = switch(
column_type, column_type,
...@@ -358,6 +358,3 @@ result<-check_valid_values(valid_colnames_with_data, codebook) ...@@ -358,6 +358,3 @@ result<-check_valid_values(valid_colnames_with_data, codebook)
print(columns_not_valid) print(columns_not_valid)
cat(result) cat(result)
#location <- paste(dir_name , "harmonized_data", "modified.csv", sep = "/")
#write.csv2(harmonized_data, location)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment