I have a data frame that contains patient survival data. I have a column for time to last follow up and a column for time to death. If the patient died, the numerical value of time will be listed in the time to death column, and not in the time to last follow up column; and vice versa if the patient is still alive. The opposite column, so if the patient is alive I am referring to the death column, there is a "[Not Available]" character string instead of a time component. Here is an example:
follow up death
100 [Not Available]
[Not Available] 300
2000 [Not Available]
I want to conditionally merge the two columns into a single column keeping just the numerical values like this:
Time
1000
300
2000
EDIT
To make this more broadly applicable, and applicable to some other datasets I have, imagine if the "[Not Available]" is not consistent. In that it could be NA, na, [Not available], null, etc. How would I write a conditional statement to merge the columns in this case? Im imagining an if statement that will keep numerical values and ignore the various character strings. Of course, in a column of a dataframe, both the numerical and character values will be classified as characters, making this just a little bit harder. Ideas?