Skip to contents

[Stable]

Returns a vector by grouping a string of years into decades

Usage

as_decade(year, method = "gregorian")

Arguments

year

numeric variable of years

method

'gregorian' or 'ISO'

Examples

as_decade(c(2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011))
#>  [1] 1990 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2010
as_decade(c(2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011), method = "ISO")
#>  [1] 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2010 2010