censusviz

所属分类:其他
开发工具:R
文件大小:0KB
下载次数:0
上传日期:2022-06-21 21:53:05
上 传 者sh-1993
说明:  塞努斯维兹,,
(censusviz,,)

文件列表:
.DS_Store (10244, 2022-06-21)
.Rbuildignore (200, 2022-06-21)
DESCRIPTION (1872, 2022-06-21)
LICENSE (70, 2022-06-21)
LICENSE.md (1099, 2022-06-21)
NAMESPACE (250, 2022-06-21)
R/ (0, 2022-06-21)
R/data.R (4343, 2022-06-21)
R/filter.R (3418, 2022-06-21)
R/leaflet.R (3960, 2022-06-21)
R/sample_people.R (3017, 2022-06-21)
R/utils.R (638, 2022-06-21)
censusviz.Rproj (343, 2022-06-21)
cran-comments.md (81, 2022-06-21)
data-raw/ (0, 2022-06-21)
data-raw/census_var_map.R (169, 2022-06-21)
data-raw/data-processing.R (2994, 2022-06-21)
data-raw/ipums_var_map.csv (6948, 2022-06-21)
data-raw/loadData.R (1122, 2022-06-21)
data/ (0, 2022-06-21)
data/boston_data_long.rda (123484, 2022-06-21)
data/boston_sample.rda (761643, 2022-06-21)
data/census_var_map.rda (1654, 2022-06-21)
data/madison_data_wide.rda (307215, 2022-06-21)
data/manhattan_sample.rda (1633001, 2022-06-21)
data/sanfrancisco_sample.rda (767469, 2022-06-21)
inst/ (0, 2022-06-21)
inst/boston1.png (3461000, 2022-06-21)
inst/boston2.png (3702009, 2022-06-21)
inst/hex-censusviz.png (118117, 2022-06-21)
man/ (0, 2022-06-21)
man/base_map.Rd (1001, 2022-06-21)
man/boston_data_long.Rd (1211, 2022-06-21)
... ...

# censusviz [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![CRAN status](https://www.r-pkg.org/badges/version/censusviz)](https://CRAN.R-project.org/package=censusviz) [![R-CMD-check](https://github.com/rporta23/censusviz/workflows/R-CMD-check/badge.svg)](https://github.com/rporta23/censusviz/actions) The [`censusviz`](https://github.com/rporta23/censusviz) package provides an interface for exploring and visualizing historical racial demographic census data (1950-2020) sourced from [IPUMS](https://data2.nhgis.org/main) for any region in the United States (by county). The package provides functionality for visualizing the data on leaflet maps as well as for accessing the data in an accessible, tidy format such that the user can then create their own visualizations. Since the data is very large, it is hosted on GitHub and is not contained in the package itself. The package includes a few smaller samples of the data as examples. The raw data can be accessed [here](https://drive.google.com/drive/folders/1teqLHG8fnrZA-ts0u2qFcQ84Q6hgi6EI?usp=sharing). See the vignette for more details. This package was inspired by the `nepm` package. The nepm package was initially created as part of a [DSC-WAV](https://dsc-wav.github.io/www/projects.html) project in fall 2021 funded by the [NSF](https://www.nsf.gov/) with the goal of creating an [interactive map](https://shiny.smith.edu:3838/bbaumer/nepm/) to visualize the demographics over time of Springfield, MA in partnership with [New England Public Media](https://www.nepm.org/). ## Installation `censusviz` is hosted on GitHub and can be installed by running the following function: ``` r remotes::install_github("rporta23/censusviz") ``` ``` r library(censusviz) ``` ## Included Datasets We have included 5 sample datasets to demonstrate the functionality of the package. These datasets consist of: - Three sample datasets for users to immediately visualize the demographic data for any census year 1950-2020 on a map: - `boston_sample` - `sanfrancisco_sample` - `manhattan sample` Users can visualize these datasets on a leaflet map using the `base_map()` and `add_people()` functions, as demonstrated in Example 1. - One dataset to demonstrate the structure of the dataset returned by the `get_data_wide()` function: - `madison_data_wide` This dataset can be used to visualize the census tract boundary lines for Madison County, NY on a leaflet map using the `base_map()` and `add_tracts()` functions, as demonstrated in the vignette. - One dataset to demonstrate the structure of the dataset returned by the `get_data_long()` function: - `boston_data_long` This dataset can be used for exploratory analysis of racial demographic data for Suffolk County, MA using `dplyr` and `ggplot2` functionality, as demonstrated in Example 2 **See the vignette and full documentation for more information on how to access and visualize the data for any county in the U.S.** ## Example 1 Visualize spatial distribution of racial demographics for any census year between 1950-2020 using `add_people()`. Dataframes with locations of dots to plot on the map for Boston, MA, Manhattan, NY, and San Francisco, CA, are included in the package. However, you can get the data for any county in the U.S. using the functions provided in `censusviz`. See the vignette for more details on how to create this type of map for any region in the U.S. ``` r # create map for Boston, MA in 1960 base_map() %>% add_people(1960, boston_sample) ``` ``` r # create map for Boston, MA in 2000 base_map() %>% add_people(2000, boston_sample) ``` ## Example 2 Create a line graph to show changes in demographics over time for Boston (Suffolk County), MA. The sample of data to create this graph for Boston is included in the package. See the vignette for details on how to create this type of graph for any region. ``` r head(boston_data_long) #> # A tibble: 6 × 11 #> GISJOIN STATE COUNTY variable n num_people pct_people year census_label #> #> 1 G2500250… Mass… Suffo… DFB001 3550 3831 0.927 1980 White #> 2 G2500250… Mass… Suffo… DFB002 188 3831 0.0491 1980 Black #> 3 G2500250… Mass… Suffo… DFB003 8 3831 0.00209 1980 American In… #> 4 G2500250… Mass… Suffo… DFB004 0 3831 0 1980 American In… #> 5 G2500250… Mass… Suffo… DFB005 0 3831 0 1980 American In… #> 6 G2500250… Mass… Suffo… DFB006 10 3831 0.00261 1980 Asian and P… #> # … with 2 more variables: race_label , is_hispanic ``` ``` r # group by year and race_label and summarize to create dataframe for line graph data_long_sum <- boston_data_long %>% group_by(year, race_label) %>% summarize(total = sum(n)) #> `summarise()` has grouped output by 'year'. You can override using the #> `.groups` argument. # create line graph to show change over time in demographics ggplot(data_long_sum, aes(x = year, y = total, color = race_label)) + geom_line() + labs( title = "Change in Racial Demographics over time in Suffolk County, MA", x = "Year", y = "Number of People", color = "Race" ) ``` ## See Also If you are interested in exploring U.S. census data, see related package [`tidycensus`](https://github.com/cran/tidycensus) ## Contributors - [Irene Foster](https://github.com/i-m-foster) - [Catherine Park](https://github.com/CJParkNW) - [Rose Porta](https://github.com/rporta23) ## Data Citation Data Sourced from IPUMS NHGIS: Steven Manson, Jonathan Schroeder, David Van Riper, and Steven Ruggles. IPUMS National Historical Geographic Information System: Version 16.0 [Database]. Minneapolis, MN: IPUMS. 2021. http://doi.org/10.18128/D050.V16.0

近期下载者

相关文件


收藏者