Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
H
Harmonize_Scripts
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Uncover
Harmonize_Scripts
Commits
2ebe9c3e
Commit
2ebe9c3e
authored
Mar 31, 2023
by
GNajeral
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
valid variables local values not duplicated
parent
33c6af54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
valid_variables_script_local.R
valid_variables_script_local.R
+6
-9
No files found.
valid_variables_script_local.R
View file @
2ebe9c3e
...
...
@@ -51,7 +51,7 @@ file_name <- readline("Introduce the name of the file to check the values: ")
harmonized_data
<-
""
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
)){
harmonized_data
<-
read.xlsx
(
file_name
)
}
...
...
@@ -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)){
# next
# next
#}
column
<-
valid_colnames
[,
i
]
...
...
@@ -315,10 +315,10 @@ check_valid_values <- function(valid_colnames, codebook_param){
column_type
<-
codebook_param
$
Variable.type
[
codebook_param
$
Harmonised.variable.name
==
name
]
if
(
is.na
(
column_type
)
)
{
variable
<-
paste
(
"Variable "
,
name
,
" wrong"
,
sep
=
" "
)
res
<-
paste
(
res
,
variable
,
sep
=
"\n"
)
next
}
variable
<-
paste
(
"Variable "
,
name
,
" wrong"
,
sep
=
" "
)
res
<-
paste
(
res
,
variable
,
sep
=
"\n"
)
next
}
result
=
switch
(
column_type
,
...
...
@@ -358,6 +358,3 @@ result<-check_valid_values(valid_colnames_with_data, codebook)
print
(
columns_not_valid
)
cat
(
result
)
#location <- paste(dir_name , "harmonized_data", "modified.csv", sep = "/")
#write.csv2(harmonized_data, location)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment