I have one variable in a data frame that lists different times, but there are some values that are actually dates. It would look something like:

Data<-c("0:03","1:15","20:37","27-Jun-12","3:55","5-May-13")

I would like to change those date values into missing values without touching any of the times. Any help is appreciated.

有帮助吗?

解决方案

There are a lot of ways to do this but here is one. If the data has a dash change to NA:

Data[grepl("-", Data)]<-NA
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top