i've this data: (complete for Dicember)
date sessions
1 2014-12-01 1932
2 2014-12-02 1828
3 2014-12-03 2349
4 2014-12-04 8192
5 2014-12-05 3188
6 2014-12-06 3277
And a need to subet/filter this, for example from "2014-12-05" to "2014-12-25"
I now that you can create a sequence with the operator ":".
Example: b <- c(1:5)
But How to filter a sequence? I tried this
NewDate <- filter(Dates, date("2014-12-05":"2014-12-12"))
But says:
Error: unexpected symbol in: "NewDate <- filter(Dates, date("2014-12-05":"2014-12-12") NewDate"
you could use
subset
Generating your sample data:
Making sure it's in date format:
Using
subset
:which gives:
you could also use
[]
:An option using
data.table
This should work even if the "date" is "character" column
In case if we wanted to subset exclusive of the range
data
If you want to use
dplyr
, you can try something like this.