I want to search all columns for 'NA' and replace with NA but running into issues when there is a date column present:
library(lubridate)
x = data.frame(a = c('NA', NA), b = c(today(), today()))
x[x == 'NA'] = NA
returns error:
Error in charToDate(x) :
character string is not in a standard unambiguous format
How can I get rid of this? I know the names of the non-date columns, tried to do something like
col = 'a'
x[x == 'NA', col] = NA
but got the same error.