You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
809 B
24 lines
809 B
## File creates file containing race & ethnicity variables at the
|
|
## tract level for DC Area from 1980 Census STF-1 data
|
|
|
|
## Set up environment
|
|
library(tidyverse)
|
|
|
|
## Identify race variable names
|
|
races <- c('totpop', 'nhw', 'nhb', 'api', 'hsp', 'oth', 'two')
|
|
praces <- paste0('p', races[-1])
|
|
racevars <- c(races, praces)
|
|
|
|
## Identify variables to keep that are not race variables
|
|
nonracevars <- c('GISJOIN', 'STATE', 'COUNTY')
|
|
|
|
## Set Functions
|
|
source('dcarea_functions.R')
|
|
|
|
load('../US/tracts/1980/tabular/race-ethnicity/dataset/tracts-1980TIGER-race-ethnicity.Rdata')
|
|
|
|
## Select DC-area tracts
|
|
racedta <- select.dcarea(trt80_re)
|
|
|
|
## Write file containing wide dataset to CSV format
|
|
write.csv(racedta, 'tracts/1980/tabular/race-ethnicity/dataset/tracts-1980TIGER-race-ethnicity.csv')
|