I have a dataset that I want to split into two by date.
Date Reading
1 1966-05-01 NA
2 1966-05-02 NA
3 1966-05-03 NA
4 1966-05-04 NA
5 1966-05-05 NA
6 1966-05-06 NA
7 1966-05-07 4.916000
8 1966-05-08 4.895000
9 1966-05-09 4.860000
10 1966-05-10 4.857417
11 1966-05-11 4.876000
12 1966-05-12 4.865857
13 1966-05-13 4.838824
14 1966-05-14 NA
The result will be :
Date Reading
1 1966-05-01 NA
2 1966-05-02 NA
3 1966-05-03 NA
4 1966-05-04 NA
5 1966-05-05 NA
6 1966-05-06 NA
7 1966-05-07 4.916000
8 1966-05-08 4.895000
AND
Date Reading
9 1966-05-09 4.860000
10 1966-05-10 4.857417
11 1966-05-11 4.876000
12 1966-05-12 4.865857
13 1966-05-13 4.838824
14 1966-05-14 NA
I have tried the following but its isn't working:
DF1 <- split(df2, df2$Date, as.Date(c(1966-05-01, 1966-05-09)))