Package 'fipio'

Title: Lightweight Federal Information Processing System (FIPS) Code Information Retrieval
Description: Provides a lightweight suite of functions for retrieving information about 5-digit or 2-digit US FIPS codes.
Authors: Justin Singh-Mohudpur [aut, cre] , Mike Johnson [ctb] , Urban Flooding Open Knowledge Network (UF-OKN) [fnd]
Maintainer: Justin Singh-Mohudpur <[email protected]>
License: MIT + file LICENSE
Version: 1.1.2.9000
Built: 2024-12-05 00:25:53 UTC
Source: https://github.com/program--/fipio

Help Index


Convert a state name, abbreviation, or county name to FIPS codes

Description

Convert a state name, abbreviation, or county name to FIPS codes

Usage

as_fips(state, county = NULL)

Arguments

state

State names, state abbreviations, or one of the following: "all", "conus", "territories"

county

County names or "all"

Value

a character vector

Examples

fipio::as_fips(state = "California")
fipio::as_fips(state = "NC")
fipio::as_fips(state = "Rhode Island", county = "Washington")
fipio::as_fips(c("CA", "North Carolina"), c("Stanislaus", "NEW HANOVER"))
fipio::as_fips("CONUS")
fipio::as_fips(state = "NC", county = "all")

Associate a set of coordinates to FIPS codes

Description

Associate a set of coordinates to FIPS codes

Usage

coords_to_fips(x, ...)

## S3 method for class 'sf'
coords_to_fips(x, ...)

## S3 method for class 'sfc'
coords_to_fips(x, ...)

## S3 method for class 'sfg'
coords_to_fips(x, ...)

## S3 method for class 'list'
coords_to_fips(x, ...)

## S3 method for class 'data.frame'
coords_to_fips(x, coords = c(1, 2), ...)

## S3 method for class 'matrix'
coords_to_fips(x, coords = c(1, 2), ...)

## S3 method for class 'character'
coords_to_fips(x, y, ...)

## S3 method for class 'numeric'
coords_to_fips(x, y, ...)

Arguments

x

data.frame, matrix, sf/sfc/sfg object, or longitude in EPSG:4326

...

Named arguments passed on to methods

coords

Coordinates columns if x is a data.frame or matrix.

y

Latitude in EPSG:4326

Value

a character vector of FIPS codes

Examples

# Some coordinates at UC Santa Barbara
coords_to_fips(x = -119.8696, y = 34.4184)

Get the state abbreviation for a FIPS code

Description

Get the state abbreviation for a FIPS code

Usage

fips_abbr(fip)

Arguments

fip

2-digit or 5-digit FIPS code

Value

a character vector

Examples

fipio::fips_abbr("37")
fipio::fips_abbr("06001")

Get the county name for a FIPS code

Description

Get the county name for a FIPS code

Usage

fips_county(fip)

Arguments

fip

2-digit or 5-digit FIPS code

Value

a character vector

Examples

fipio::fips_county("37129")
fipio::fips_county("06001")

# 2-digit FIP codes will not work
fipio::fips_county("37")

Get the geometry for a FIPS code

Description

Get the geometry for a FIPS code

Usage

fips_geometry(fip)

Arguments

fip

2-digit or 5-digit FIPS code

Value

an sfg/sfc object

Examples

## Not run: 
fipio::fips_geometry("37")
fipio::fips_geometry("06001")

## End(Not run)

Get the metadata for a FIPS code

Description

Get the metadata for a FIPS code

Usage

fips_metadata(fip, geometry = FALSE)

Arguments

fip

2-digit or 5-digit FIPS code

geometry

If TRUE, returns a geometry column

Value

a data.frame

Examples

fipio::fips_metadata("37")
fipio::fips_metadata("06001")

Get the state name for a FIPS code

Description

Get the state name for a FIPS code

Usage

fips_state(fip)

Arguments

fip

2-digit or 5-digit FIPS code

Value

a character vector

Examples

fipio::fips_state("37")
fipio::fips_state("06001")

Get the matching function that fipio is using

Description

This function is primarily for debugging purposes, or for ensuring that the correct matching function is used.

Usage

using_fastmatch()

Value

TRUE if fastmatch::fmatch is used.