![]() Vt_census |> select ( NAME ) |> separate_wider_delim ( NAME, delim = ", ", names = c ( "block", "block_group", "tract", "county", "state" ) ) #> # A tibble: 2,150 × 5 #> block block_group tract county state #> #> 1 Block 1014 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 2 Block 1015 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 3 Block 1016 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 4 Block 1017 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 5 Block 1018 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 6 Block 1019 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 7 Block 1020 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 8 Block 1021 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 9 Block 1022 Block Group 1 Census Tract 9555.02 Washington County Vermont #> 10 Block 1023 Block Group 1 Census Tract 9555.02 Washington County Vermont #> # … with 2,140 more rows Separate_wider_position() to extract these into their own variables: The GEOID column is made up of four components: a 2-digit state identifier, a 3-digit county identifier, a 6-digit tract identifier, and a 4-digit block identifier. #> This message is displayed once per session. #> ℹ Small counts should be interpreted with caution. ![]() Vt_census Getting data from the 2020 decennial Census #> Using the PL 94-171 Redistricting Data summary file #> Note: 2020 decennial Census data use differential privacy, a technique that #> introduces errors into data to preserve respondent confidentiality. Let’s start by grabbing some census data with the Here I’ll focus on the wider functions because they generally present the most interesting challenges. Separate_rows() because they have more consistent names and arguments, have better performance (thanks to stringr), and provide a new approach for handling problems. The biggest feature of this release is a new, experimental family of functions for separating string columns: Library ( tidyr ) library ( dplyr, nflicts = FALSE ) separate_*() family of functions
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |