Substitute wrong dates with more than two forward slashes for NA (in R)

Viewed 56

I would like to get rid off some dates in a column that are as follow (there are more than 40.000 records and I cannot go one by one):

d <- c("16/19/07/1953",
"16/19/08/1953",
"16/21/7/1/59",
"16/21/vii/1967")

I would like just to substitute these dates that have three forward slashes or more in some cases by NA. Any help or advice would be much appreciated!

0 Answers
Related