Convert sampled lat/lon points to block groups
sampled_latlon_to_bg.RdConvert sampled latitude/longitude points to Census block groups using spatial join. Use to assign block group IDs for geocoded survey or synthetic data.
Arguments
- latlon_dt
data.table with required columns:
lat
— latitude lon
— longitude Additional columns as needed for geocoding Rows: one per point. Modified by reference: no.
- settings
list. Must include:
pums_year
— PUMS reference year Additional settings as needed for geocoding Modified by reference: no.
- bg_geoyear
integer. Year of block group geographies. Default: PUMS year.
Value
data.table with columns:
lat
— latitude lon
— longitude bg_geoid
— Census block group identifier Additional columns for diagnostics or input variables (type varies) Rows: one per point.
Details
Converts input data.table to sf object and transforms CRS.
Fetches block group geometries for specified year and FIPS codes.
Joins block groups to lat/lon points using spatial intersection.
Returns a copy; does not modify by reference.
Assumes valid lat/lon columns and settings; errors if missing.
See also
scripts/io/sample_latlon_to_bg.R
Other io utilities:
clean_data_dict(),
cut_and_label(),
db_table_has_geometry(),
fetch_acs(),
fetch_all_hts_tables(),
fetch_from_db(),
fetch_hts_table(),
fetch_pums(),
fetch_study_region(),
find_project_root(),
fix_value_labels_on_load(),
get_db_table_name(),
print_params(),
pums_checksum(),
read_from_db(),
read_pums_codebook(),
record_checksum()