I have a data frame where one column is (meant to be) a date in the form 00:00:00.0 yyyy-mm-dd. Most of the entries are, but some are not. Is there a way to delete the rows that contain non-dates? Something like (if the column is “DATE”)
data <- data[is.Date(DATE)==TRUE,]
For example.
Fruit Date
apple 00:00:00.0 2005-02-01
pear 00:00:00.0 2006-02-01
orange 00:00:00.0 -8-2-402145
rhino 00:00:00.0 2003-04-21
I want
Fruit Date
apple 00:00:00.0 2005-02-01
pear 00:00:00.0 2006-02-01
rhino 00:00:00.0 2003-04-21
Following joran’s reasoning:
Result: