Learn R Programming

eiCompare (version 3.0.4)

fips_extract: Extract geographic unit codes from FIPS codes.

Description

This function will split up a column of FIPS codes into several columns, each containing the individual code at different units. It is agnostic to the level of the FIPS codes (i.e., FIPS codes are not required to be 15 digits long). However, this function assumes that all FIPS codes begin at the state level of precision.

Usage

fips_extract(df, fips_col = NULL, geo = NULL)

Value

A dataframe with additional columns containing the individual codes for different geographic units.

Arguments

df

The dataframe, with one column containing FIPS codes.

fips_col

A string denoting the column containing the FIPS codes.

geo

A string denoting the smallest geographic unit in the FIPS code. If NULL, the smallest geographic unit is determined based off the length of the FIPS codes.