My data looks like this: https://i.sstatic.net/zXk8a.jpg
I want to change the values NA
to another value for each column.
For example in the column that contains NA
, Single
and Dual
, I want to change all the NA
to 'Single'
.
I tried this code:
data_price$nbrSims <- ifelse(is.na(data_price$nbrSims), 'Single', data_price$nbrSims)
But then my data looks like this, where Dual
became 2
and Single
1
.
https://i.sstatic.net/I9oUw.jpg
How can I change the NA
values, without changing the other values?
Thanks in advance!