Visualization
Data Notes
In 2017, 34.5% of young adults (18 to 34 years old) in the U.S lived with their parents. This data visualization explores how that differs by state. The data for this visualization comes from the U.S. Census Bureau’s 2017 American Community Survey 1-year estimates.To be included in this count, the home had to be owned or rented by the parent(s) and the parent(s) had to be living in the home. For more information visit https://census.gov/acs.
I used R to pull the ACS estimates from the Census Bureau API and Tableau to create the visualization. I have included the R Code below that I used to pull data for all the living arrangements for young adults. You are also able to download the Tableau workbook if interested.
R Code
[accordions]
[accordion title=”R Code” load=”hide”]Var_17 <-
read.table(“https://api.census.gov/data/2017/acs/acs1?get=NAME,B09021_009E,B09021_010E,B09021_011E,B09021_012E,B09021_013E,B09021_014E&for=state”,
header=TRUE, sep=”,”, na.strings=”NA”, dec=”.”, strip.white=TRUE)
Var_17$Name <- with(Var_17, substring(X..NAME, 2))
Var_17$State_FIPS <- with(Var_17, substring(state., 1,2))
Var_17 <- within(Var_17, {
X <- NULL
X..NAME <- NULL
state. <- NULL
Alone <-B09021_009E
B09021_009E <- NULL
Spouse <-B09021_010E
B09021_010E <- NULL
Partner <-B09021_011E
B09021_011E <- NULL
Child <-B09021_012E
B09021_012E <- NULL
Other_Rel <-B09021_013E
B09021_013E <- NULL
Other_Non <-B09021_014E
B09021_014E <- NULL
})
library(reshape2, pos=17)
mdata <- melt(Var_17, id=c(“Name”,”State_FIPS”))
Young_Adult <- within(mdata, {
Estimate <- value
value <- NULL
HH_Type <- variable
variable <- NULL
})
write.table(Young_Adult, “C:/Users/***********/Documents/R Datasets/Young_Adults_Home.csv”, sep=”,”, col.names=TRUE, row.names=FALSE, quote=FALSE, na=”NA”)[/accordion]
[/accordions]
If you want to keep up with our surveys and data analysis, be sure to follow us on Twitter and Facebook.
In what states are young adults most likely to live with their parents? #dataviz https://t.co/W7yqdXs9T5 pic.twitter.com/iy956H5F8l
— Overflow Data (@overflow_data) December 23, 2018