[R] data manipulation question
y@ngk@|9999 @end|ng |rom y@hoo@com
Tue Aug 24 01:22:17 CEST 2021
I wrote the script below to assign value to a new field DisclosureStatus.
my goal is if gl_resultsdisclosed=1 then DisclosureStatus=DISCLOSED
else if gl_resultsdisclosed=0 then DisclosureStatus= ATTEMPTED
else if gl_resultsdisclosed is missing and gl_discloseattempt1 is not missing then DisclosureStatus= ATTEMPTED
ifelse(germlinepatients$ gl_resultsdisclosed==0, "ATTEMPTED",
ifelse(is.na(germlinepatients$gl_resultsdisclosed) & germlinepatients$gl_discloseattempt1!='', "ATTEMPTED",
the first 3 row give me right result, but the 3rd row does not. After checking the data, there are 23 cases are gl_resultsdisclosed is missing and gl_discloseattempt1 is not missing. the code doesn't has any error message.
[[alternative HTML version deleted]]
More information about the R-help