R/bg18.R

#' @name bg18
#' @docType data
#' @title The 2018 version of EJSCREEN data, plus lat lon, countynames, etc., minus some nonessential fields
#' @description
#'   Note the 2018 version of EJSCREEN (released late 2018)
#'     actually uses ACS2016, which is from 2012-2016 (released late 2017).
#'   Note the 2019 version of EJSCREEN (released late 2019)
#'     actually uses ACS2017, which is from 2013-2017 (released late 2018).
#'
#'   This data set is the EJSCREEN 2018 dataset from the ftp site but with
#'   fields renamed for easier use in the ejscreen package,
#'   and some columns dropped (svi6-related, and the 2 alternative versions of an EJ Index)
#'   and some fields added (lat lon for bg centroids, flagged if any of EJ indexes above 80th percentile in US),
#'   and state name and state abbrev and county name and FIPS for tract, county, state,
#'   BUT NOT REMOVING a handful of rows removed from the bg17 data (that had NA values in FIPS.ST)
#' @details
#'   bg18 was created for this package as follows: \cr\cr
#'   \code{ bg18 <- ejscreen.download(yr = 2018, addflag = TRUE)} \cr
#'   \code{ #    OR IF ALREADY DOWNLOADED AND UNZIPPED, JUST DO THIS: }\cr
#'   \code{#  bg18 <- ejscreen.download(justreadname = 'EJSCREEN_Full_USPR_2018.csv', addflag = TRUE)} \cr\cr
#'   # Starts by reading in 368 columns from csv, then has about 373 columns \cr
#'   # after \link{ejscreen.download}, which renames fields, drops an ID field, \cr
#'   # and adds fields called FIPS.TRACT, FIPS.COUNTY, FIPS.ST, countyname, flagged. \cr\cr
#'   # Then for this package, got rid of some nonessential fields:  \cr
#'   # (But note svi6 fields - which combine all 6 demog indicators not just 2 - were named in names.d) \cr\cr
#'   \code{bg18 <- bg18[ , !grepl(pattern = 'svi6', x = names(bg18))]} \cr
#'   \code{bg18 <- bg18[ , !grepl(pattern = 'pctile\\\\.text', x = names(bg18))]} \cr
#'   \code{bg18 <- bg18[ , !grepl(pattern = 'EJ\\\\.PCT', x = names(bg18))]} \cr
#'   \code{bg18 <- bg18[ , !grepl(pattern = 'EJ\\\\.BURDEN', x = names(bg18))]} \cr
#'   \code{bg18 <- bg18[ , names(bg18) != 'ID_1'] } \cr
#'   \code{bg18 <- bg18[ , names(bg18) != 'Shape_Length'] } \cr
#'   # The ID_1 field is like FIPS but NA where some data missing \cr\cr
#'   # Then added lat, lon fields for block group centroids, via \link[proxistat]{bg.pts} from proxistat package:\cr
#'   \code{bg18 <- merge(bg18, bg.pts[ , c('FIPS', 'lat')], by.x = 'FIPS', by.y = 'FIPS', all.x = TRUE, all.y = FALSE)} \cr
#'   \code{bg18 <- merge(bg18, bg.pts[ , c('FIPS', 'lon')], by.x = 'FIPS', by.y = 'FIPS', all.x = TRUE, all.y = FALSE)} \cr\cr
#'   \code{save(bg18, file = 'bg18.rdata')} \cr
#'   \code{plot(bg18$lon[bg18$lon < -50], bg18$lat[bg18$lon < -50], pch = '.')} \cr\cr
#'   # \code{sum(is.na(bg18$FIPS.ST))} \cr
#'   # \code{[1] 13} \cr\cr
#' @concept datasets
#' @format data.frame with 220,333 rows (block groups) and 118 columns
NULL
ejanalysis/ejscreen documentation built on Dec. 31, 2019, 11:52 p.m.