Reputation: 95
I have the following data from Facebook
ID Message Created_Time
12223 Hello World 2014-10-03T13:16:32+0000
24421 Hello 2014-10-03T13:00:00+0000
34551 Sweet 2014-11-03T13:16:34+0000
12333 Cool 2014-02-26T20:00:00+0000
12231 Really Cool! 2013-03-26T19:00:00+0000
My question is now how to filter out the posts that have 00:00+0000 in the time stamp?
I would like to have two data frames. One with the posts that have the 00:00+0000 in the stamp and one with all others.
I tried to do it with grepl, but it did not work. Any help is really appreciated.
Best thanks beforehand.
Upvotes: 0
Views: 180
Reputation: 12654
The lubridate
library and dplyr
will make this easier.
library(lubridate)
library(dplyr)
## call your original data frame df and the time column MyTime
df$MyTime<-ymd_hms(df$MyTime)
df2<-filter(df, minute(MyTime)!=0 | sec(MyTime)!=0 )
df3<-fitler(df, minute(MyTime)==0 & sec(MyTime)==0)
Edit: added in the minute
parts as I missed that part at first.
Upvotes: 4