There are some values in my dataset(df) that needs to be replaced with correct values e.g.,
| Height | Disease | Weight>90kg |
|---|---|---|
| 1.58 | 1 | 0 |
| 1.64 | 0 | 1 |
| 1.67 | 1 | 0 |
| 52 | 0 | 1 |
| 67 | 0 | 0 |
I want to replace the first three values as '158', '164' & '167'. I want to replace the next as 152 and 167 (adding 1 at the beginning).
I tried the following code but it doesn't work:
data_clean <- function(df) {
df[height==1.58] <- 158
df}
data_clean(df)
Please help!