Helper function to convert any time period to days

convert_period_to_days(period)

Arguments

period

A string that contains a time period, e.g. "3 days", "1 week", "2 months", "1 year"

Value

The number of days in the time period

Examples

convert_period_to_days("3 days")
#> [1] 3
convert_period_to_days("1 week")
#> [1] 7
convert_period_to_days("2 months")
#> [1] 60
convert_period_to_days("1 year")
#> [1] 365