ts2yearweek: Convert timestamp to year_week.

View source: R/ts2yearweek.R

ts2yearweekR Documentation

Convert timestamp to year_week.

Description

ts2yearweek extracts the week of the year and the year from a timestamp and concatenates both to create a unique identifier for each week of the year. Around the turn of the year, sometimes, the week of the year switches already in the last days of the year, or does not switch at the first days of the new year. These days are corrected to maintain continuous numbering.

Usage

ts2yearweek(ts)

Arguments

ts

A vector with timestamps or dates in format POSIXct or Date.

Value

A vector with year_week identifier for each week of the year.

Examples

 ts2yearweek(as.Date("2017-01-01"))

maxkroeschel/activitytools documentation built on July 31, 2023, 1:34 p.m.