keep_sundays: Keeps sundays If you provide a vector of dates, this function...

keep_sundaysR Documentation

Keeps sundays If you provide a vector of dates, this function will keep the sundays and the latest date

Description

Keeps sundays If you provide a vector of dates, this function will keep the sundays and the latest date

Usage

keep_sundays(dates, format = "Uke isoweek_c-1/isoweek_c", keep_delete = TRUE)

Arguments

dates

Vector of dates

format

Choose between: "isoyearweek_c", "Uke isoweek_c", "isoyearweek_c-1/isoyearweek_c", "Uke isoweek_c-1/isoweek_c", "date"

keep_delete

Keep everything in the same format as provided

Examples

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "isoyearweek_c",
  keep_delete = TRUE
)

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "Uke isoweek_c",
  keep_delete = TRUE
)

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "isoyearweek_c-1/isoyearweek_c",
  keep_delete = TRUE
)

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "Uke isoweek_c-1/isoweek_c",
  keep_delete = TRUE
)

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "date",
  keep_delete = TRUE
)

fhiplot::keep_sundays(
  dates = seq.Date(as.Date("2020-01-01"), as.Date("2020-02-01"), by=1),
  format = "date",
  keep_delete = FALSE
)

folkehelseinstituttet/fhiplot documentation built on March 25, 2022, 7:59 a.m.