factor_aweek: Coerce an aweek object to factor to include missing weeks

View source: R/factor_aweek.R

factor_aweekR Documentation

Coerce an aweek object to factor to include missing weeks

Description

Coerce an aweek object to factor to include missing weeks

Usage

factor_aweek(x)

Arguments

x

an aweek object

Value

an aweek object that inherits from factor() with levels that span the range of the weeks in the object.

Note

when factored aweek objects are combined with other aweek objects, they are converted back to characters.

Examples

w <- get_aweek(week = (1:2) * 5, year = 2019, day = c(7, 1))
w
wf <- factor_aweek(w)
wf

# factors are destroyed if combined with aweek objects
c(w, wf)

aweek documentation built on Oct. 6, 2022, 9:07 a.m.