Vote count:
0
I have three date columns as shown below
Id Date1 Date2 Date3
12 2005-12-22 NA NA
11 2009-10-11 NA NA
29 NA 2005-04-11 NA
45 NA NA 2008-11-06
39 NA NA 2006-01-02
44 NA 2005-04-16 NA
I am trying to collapse the three Date columns in to one Date column and create an index variable 1 if there was a Date value in Date1 column, 2 if there was a Date in Date2 column and 3 if there was a Date in Date3 column
Id Date Index
12 2005-12-22 1
11 2009-10-11 1
29 2005-04-11 2
45 2008-11-06 3
39 2006-01-02 3
44 2005-04-16 2
I can do this using a massive ifelse statement i was wondering if anybody knew an efficient method of doing this ?
asked 22 secs ago
collapse mulitple columns into one column and generate an index variable
Aucun commentaire:
Enregistrer un commentaire