Home > OS >  Replace certain dates with NA in R
Replace certain dates with NA in R

Time:11-11

How can I replace the value/date 1970-01-01 00:00:00 in one columne with NA in R?

tried this:

ESM13$Committed[ESM13$Committed == "1970-01-01 00:00:00"] <- NA

didn't work. Couldn't figure out how to use mutate either.

CodePudding user response:

I think 1970-01-01 00:00:00 is the datetime associated with the internal value of 0. So I'm guessing the following should work:

ESM13$Committed[as.numeric(ESM13$Committed) == 0] <- NA
  • Related