Hi Michael, I mean the character string "null".
Thanks, Ben On Fri, Sep 16, 2011 at 10:40 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Do you actually mean the character string "null" or do you mean the NULL it > doesn't exist thing? If that's the case, you need to write is.null(), > something like is.NA()... > > Michael Weylandt > > On Fri, Sep 16, 2011 at 10:36 AM, Ben Ganzfried > <ben.ganzfr...@gmail.com>wrote: > >> 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. >> > > [[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.