I am trying to create a column "complete" based on logical statements for values of one other column. The column is named "etc001_processed" and includes the numbers of testlets one person completed. There are a lot of people who didn't complete the "etc001" testlet at all, so there are a lot of NA's. I want the create the column "complete" which:
- is NA if etc001_processed is NA
- is 1 if etc001_processed is 12
- is 0 if etc001_processed is not 12 or NA
> print(dat_de$etc001_processed)
[1] NA NA NA NA 12 NA NA NA NA NA NA 12 NA 9 NA 12 7 NA 12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA 12 12 NA NA NA 12 NA NA NA NA
[44] 12 12 NA 12 NA 12 NA NA 12 12 NA 12 NA 12 NA NA 12
thank you!
Aucun commentaire:
Enregistrer un commentaire