library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
floor_date(ymd("2016-02-29"), "year")
#> [1] "2016-01-01"
floor_date(ymd("2016-03-01"), "year")
#> [1] "2015-12-31"
# I would expect the equivalent of this
ymd("2016-02-29") - ddays(yday(ymd("2016-02-29")) - 1)
#> [1] "2016-01-01"
ymd("2016-03-31") - ddays(yday(ymd("2016-03-31")) - 1)
#> [1] "2016-01-01"