Pad GEOID columns to fixed width
geoid_pad.RdPads GEOID columns in a data.table to required width with leading zeros. Use for preparing census codes for spatial analysis or database joins.
Details
Pads columns for block group, PUMA, county, and state.
Returns a copy; does not modify by reference.
Assumes columns are character or integer.
See also
clip.vector
Other geo utilities:
format_geoids(),
get_bg_geom(),
get_county_fips(),
get_puma_geom(),
get_state_fips(),
pad_geoid_cols()
Examples
dt <- data.table(bg = c(12345678901, 23456789012))
geoid_pad(dt)
#> bg
#> <char>
#> 1: 012345678901
#> 2: 023456789012