state_from_sitetable - Identify US State that each site is in (given ST, FIPS, or lat/lon)
Source:R/state_from_sitetable.R
state_from_sitetable.Rd
Identify US State that each site is in (given ST, lat/lon, or FIPS)
Arguments
- sites
data.frame or data.table, with one row per site, and column(s) that are either "ST" (2-letter abbreviation of State), "lat" and "lon", or "fips" or "bgfips" and optionally a column like "ejam_uniq_id" or "n"
- ignorelatlon
set to TRUE to skip the slowest step of inferring ST from latlon in case you want to do that via sites2blocks info on blocks nearby
Value
the input table as a data.frame, but with these new columns if ST was not already a column: ejam_uniq_id, ST, statename, FIPS.ST, REGION, n
Examples
state_from_sitetable(testpoints_10)
state_from_sitetable(testoutput_ejamit_10pts_1miles$results_bysite[, .(ejam_uniq_id, ST, pop)])
state_from_sitetable(testoutput_ejamit_10pts_1miles$results_bysite[, .(ST, pop)])
state_from_sitetable(testoutput_ejamit_10pts_1miles$results_bysite[, .(ST, lat, lon, pop)])