View source: R/district-coding.R
to_cd | R Documentation |
Concatenate to Congressional District code
to_cd(state, num)
state |
A vector of state names, preferably abbreviations. If it is numeric, the function will assume they are FIPS codes and translate them accordingly. If they have full names like "California" instead of "CA", it will translate that too. But you cannot mix different types. |
num |
A vector of district codes |
library(dplyr)
to_cd(c("AL", "AK"), c("5", "AL"))
to_cd(c(1, 2), c("5", "AL"))
to_cd(c("Alabama", "Alaska"), c("5", "AL"))
transmute(cc18_samp,
inputstate,
cdid115,
cd = to_cd(inputstate, cdid115))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.