Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Filter to a specific date within a specific column

$
0
0

I have a dataframe, df with column DateTimeUTC.

                         ID              DateTimeUTC

                         A               12/4/2019 11:30:30 PM
                         A               12/4/2019 11:30:30 PM
                         B               12/5/2019 11:30:30 PM
                         B               12/5/2019 11:30:30 PM
                         B               12/5/2019 11:30:30 PM

I would like to filter, so that DateTimeUTC only displays dates from 12/5/2019, with this outcome:

                           ID              DateTimeUTC


                         B               12/5/2019 11:30:30 PM
                         B               12/5/2019 11:30:30 PM
                         B               12/5/2019 11:30:30 PM

I have tried this command, but have not been successful:

                       library('dplyr')
                       library('lubridate')

                       data %>%  filter as.Date(DateTimeUTC == "2019-12-05")

I would like ALL days of 12/5/2019, including the times (hours, min and secs) Is this possible?


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>