get_pufyear: Add a PUF year column

View source: R/utils-conv.R

get_pufyearR Documentation

Add a PUF year column

Description

This column notes the file from which the record came.

Usage

get_pufyear(df, filename)

Arguments

df

a data table to append the new column to

filename

the file name from which the record was derived

Details

Matches the year of the file from the file name using a regular expression. Requires that the original file names are not changed.

Value

a data table with a new ordered factor column called pufyear

Examples

x <- data.table::data.table(x = rep("name", 10))
nsqipr:::get_pufyear(x, "acs_nsqip_puf12.txt")
x$pufyear < "2013"
x$pufyear > "2005-2006"


dylanrussellmd/nsqipr documentation built on Oct. 13, 2023, 11:01 a.m.