R ifelse statement

Add another variable B to dataset and use ifelse function where you get 0 for “N”and 1 for “Y” values

Dataset$B <- ifelse(Dataset$A=="N",0,1)

or you can use ifelse function on same variable as

Dataset$A <- ifelse(Dataset$A=="N",0,1)

Leave a Comment