Hi guys,

My code (next 2 lines below) isn't doing what I'm expecting it to:

tmp <-
ifelse(uncurated$days_to_tumor_recurrence=="null","norecurrence","recurrence")
curated$recurrence_status <- tmp

I want the column "recurrence_status" in my output file to have values
"recurrence" (if the input value had a number in the
days_to_tumor_recurrence column for the particular patient) or
"norecurrence" (if the input value said "null" in the
days_to_tumor_recurrence column for the particular patient).

Part of my above code gives me what I want. My current output file does
indeed get "recurrence" everywhere it should say this.  But for the input
values of "null" I am getting output values of NA instead of
"norecurrence."  I tried the following strategies to solve this and was
unsuccessful.

First, I added a line in the middle of the two above lines of code, with the
following:
tmp[tmp==NA] <- "norecurrence"

This did not work.

Second, I changed the first line of my code to:
tmp <-
ifelse(uncurated$days_to_tumor_recurrence==NA,"norecurrence","recurrence")

This was worse, as was trying:

tmp <-
ifelse(uncurated$days_to_tumor_recurrence=="NA","norecurrence","recurrence")

I would greatly appreciate any advice you may have. Also, why is this
happening?

Thanks a bunch,

Ben

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to