dimanche 7 juin 2020

Why is my ifelse function changing all values to "FALSE", and how can I make it work?

I am working on mutational data of genes, which consists of a column per gene, with the gene either having "no alteration", or a specific mutation. In one column, I want the non-altered genes to be changed to "Wildtype", and all the different mutations to be changed to simply "Mutated". I have tried using the ifelse function for this with the following code: dat$RB <- ifelse(dat$RB != "no alteration", dat$RB == "Mutated RB", dat$RB == "Wildtype RB"). However, when I use this, all values in the column simply change to "FALSE". Why is this not working, and what should I do to achieve my goal?

Aucun commentaire:

Enregistrer un commentaire