Skip to contents

Adds year as the first column of dt by reference. When stacking multiple annual datasets the year column is the primary grouping variable. No-op when year_tag is NULL.

Usage

.inject_year(dt, year_tag)

Arguments

dt

A data.table (modified by reference).

year_tag

Integer or NULL.

Value

dt invisibly.