I have manually separated my dataset (`discrete_8`) into 2 separate datasets (`data` & `data2`). `'Data'` contains the data from this current year (2021), whereas `'Data2'` contains data from previous years. Of course, this is based on the current year (2021), but I want to automate the line of code so that when the year 2022 comes, I will not have to edit the script to change 2021 to 2022. Should I use `Sys.Date()` for calling the most recent year? How would I go about incorporating `sys.date()` to partition the dataset?
Here is my code so far, where I partition the dataset:

```
data <- discrete_8 %>%  filter(PS_DATE >= as.POSIXct("2021-01-01"))#current year
data2 <- discrete_8 %>%  filter(PS_DATE < as.POSIXct("2021-01-01"))#past years

```

Here is what discrete\_8 looks like:

```
 X       PS_DATE PS_NAME Control.Parameters.Cell.Return.Flow.Rate Control.Parameters.Harvest.Flow.Rate Control.Parameters.Microsparger.Total.Gas.Flow.Rate
1 0 2014-02-06 123                                      NA                                   NA                                                   1
2 1 2014-02-07 124                                      NA                                   NA                                                   1
3 2 2014-02-08 125                                       NA                                   NA                                                   1
4 3 2014-02-09 126                                      1.5                                   NA                                                   1
5 4 2014-02-10 127                                      1.5                                   NA                                                   1
6 5 2014-02-11 128                                     1.5                                   NA                                                   1

```