I have dataframe tr which contins around 1700 rows. I am trying to replace Type column values wherever they NA with string "None".
I do a quick count to check how na's I have in my Type column.
na_count= tr[which(is.na(tr$Type)),]
na_count contains 8 records.
Now I replace all the NAs with "None" using
ifelse(is.na(tr$Type),tr$Type<-'None',0)
The above command is replacing all the 1700 rows with None instead of just the 8. I'm not sure why that is happening.
Aucun commentaire:
Enregistrer un commentaire