Start to clean up download block data Renames columns, drops most, calculates total area.
Source:R/census2020_clean.R
census2020_clean.RdStart to clean up download block data Renames columns, drops most, calculates total area.
Usage
census2020_clean(
x,
cols_to_keep = c("blockfips", "lat", "lon", "pop", "area"),
sumlev = 750,
mystates,
census_col_names_defined = census_col_names_map
)Arguments
- x
data from
census2020_read()- cols_to_keep
optional, which (renamed or not) columns to retain and return. "all' means keep them all. They will be renamed via census_col_names_map even if listed in cols_to_keep in the un-renamed form, like P0020002 vs hisp.
- sumlev
just used by
census2020_get_data()to correctly name the fips column.- mystates
just used by
census2020_get_data()to correctly rename the data columns.
Details
Renames and drops columns based on names in census_col_names_defined such as in census_col_names_map for the US/DC/PR (or island area specific versions) and the parameter cols_to_keep, but see census_col_names_map for what could be retained.
Returns table in data.table format.
area is in square meters and is sum of land and water areas.