I have a data frame with the character variable ID. It has IDs with 9 digits and 3 other values: blank, N/A and NA. I want to replace blank, N/A and NA with 999999999.
I tried using this:
df$id <- gsub('','999999999', df$id)
But it replaces all blanks (even with valid IDs). What is the best way to do this?
id <- c("", "N/A", "123456789", "NA","123456789")
> dummydata <- data.frame(id)