I want to create an if statement if the string cannot be converted to date, like the one below:
as.Date("2010-00-01")
But running the line above just keep giving the error output below:
Error in charToDate(x) :
character string is not in a standard unambiguous format
Which I cannot use it for if statement, how can I use a if statement if the string cannot be converted to date? Thanks.
Provide the
formatarg so it won’t be ambiguous. Bad dates are then always turned intoNA.