I have dataframe tr
which contins around 1700 rows. I am trying to replace Type
column values wherever they are NA
with string "None"
.
I do a quick count to check how many 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 NA
s 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.