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
fb7766e9
Commit
fb7766e9
authored
Mar 07, 2023
by
GNajeral
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix for variables without format
parent
a81fb7fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
valid_variables_script2.R
valid_variables_script2.R
+2
-4
No files found.
valid_variables_script2.R
View file @
fb7766e9
...
...
@@ -134,20 +134,19 @@ check_values_format <- function(valid_columns, codebook_param){
current_column
<-
valid_columns
[[
1
]][[
i
]]
print
(
current_column
)
variable_type
<-
codebook_param
$
Variable.type
[
codebook
$
Harmonised.variable.name
==
current_column
]
possible_values
<-
codebook_param
$
Possible.values.format
[
codebook_param
$
Harmonised.variable.name
==
current_column
]
if
(
length
(
variable_type
)
>
1
||
is.na
(
variable_type
)){
if
(
length
(
variable_type
)
>
1
||
is.na
(
variable_type
)
||
is.na
(
possible_values
)
){
next
}
print
(
variable_type
)
if
(
variable_type
==
"Continuous"
){
################## ESTO PODRÍA IR EN UNA FUNC DIFERENTE #############
### parse del formato de una variable continua ##
## esta sentencia funciona codebook$Possible.values.format[codebook$Harmonised.variable.name == "CMXDE"] pruebala en el interprete.
possible_values
<-
codebook_param
$
Possible.values.format
[
codebook_param
$
Harmonised.variable.name
==
current_column
]
value_format
<-
strsplit
(
possible_values
,
" / "
)[[
1
]]
low_limit
<-
str_trim
(
gsub
(
","
,
"."
,
(
sub
(
"-.*"
,
""
,
value_format
[
1
]))))
high_limit
<-
str_trim
(
gsub
(
","
,
"."
,
(
sub
(
".*-"
,
""
,
value_format
[
1
]))))
...
...
@@ -202,7 +201,6 @@ check_values_format <- function(valid_columns, codebook_param){
################## FIN ESTO PODRÍA IR EN UNA FUNC DIFERENTE #############
}
else
if
(
variable_type
==
"Categorical"
||
variable_type
==
"Binary"
){
possible_values
<-
codebook_param
$
Possible.values.format
[
codebook_param
$
Harmonised.variable.name
==
current_column
]
value_format
<-
lapply
(
strsplit
(
possible_values
,
"/"
)
,
str_trim
)[[
1
]]
tryCatch
(
error
=
function
(
cnd
)
{
...
...
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