clean_census_columns.RdCleans the variable names and splits them into columns in a long table.
clean_census_columns(.data)
| .data | The data frame to be cleaned. Must be a long dataframe returned by read_nz_census_data() |
|---|
nz_dwelling_regions_long <- transform_census(dwelling_regions, include_gis = FALSE, long = TRUE, replace_confidential_values = NA_integer_) cleaned_data <- clean_census_columns(nz_dwelling_regions_long) head(cleaned_data)#> # A tibble: 6 x 7 #> Area_Code_and_Des… Code Description year topic variable value #> <chr> <chr> <chr> <chr> <chr> <chr> <int> #> 1 01 Northland Regi… 01 Northland Re… 2001 "dwelling re… Occupied No… 471 #> 2 02 Auckland Region 02 Auckland Reg… 2001 "dwelling re… Occupied No… 1548 #> 3 03 Waikato Region 03 Waikato Regi… 2001 "dwelling re… Occupied No… 843 #> 4 04 Bay of Plenty … 04 Bay of Plent… 2001 "dwelling re… Occupied No… 528 #> 5 05 Gisborne Region 05 Gisborne Reg… 2001 "dwelling re… Occupied No… 114 #> 6 06 Hawke's Bay Re… 06 Hawke's Bay … 2001 "dwelling re… Occupied No… 342