View source: R/combine_cbs_muni.R
| combine_cbs_muni | R Documentation |
This function is a wrapper around read_cbs_muni() to help in combining data
for cities, local councils and regional councils.
From 2015 and earlier, the Israeli CBS publishes municipal data on different
sheets and formats for cities and local councils, and for regional councils.
This function enables the user to combine the two data frames for selected
columns. It is up to the user to take care of the specific match between specific
columns.
combine_cbs_muni(
path,
year,
cols_city,
cols_rc,
data_domain = c("physical", "budget"),
col_names = NULL,
col_names_from = c("city_lc", "rc")
)
path |
A character vector of length 1, denoting the local file path to the municipal data file. A full list of available files by the CBS is at the relevant CBS page. |
year |
A numeric vector of length 1 denoting which year the data file
pointed in |
cols_city |
<tidy-select> Columns to keep from the cities and local councils sheet. |
cols_rc |
<tidy-select>
Columns to keep from the regional councils sheet. Should be in the same order
of desired columns as in |
data_domain |
A character vector of length 1, one of
|
col_names |
A character vector containing the new column names of the
output tibble. If |
col_names_from |
A character vector of length 1, one of
|
A tibble with municipal data for a specific year, with the columns from
cols_city and cols_rc bound by rows and matched by order of columns. Every row is a
municipality and every column is a different variable for this municipality in
that year. Be advised all columns are of type character, so you need to parse
the data types yourself at will. Column names are merged from the relevant headers,
and only single whitespaces are kept. Rows with more than 90% empty cells (usually
rows with non-data notes) are removed.
df_1 <- combine_cbs_muni(
system.file("extdata", "2009.xls", package = "il.cbs.muni"),
year = 2009,
cols_city = c(1:7, 11),
cols_rc = c(1:7, 25)
)
df_1 |>
dplyr::glimpse()
df_2 <- combine_cbs_muni(
system.file("extdata", "2009.xls", package = "il.cbs.muni"),
year = 2009,
cols_city = c(1:12),
cols_rc = c(1:12),
data_domain = "budget",
col_names_from = "rc"
)
df_2 |>
dplyr::glimpse()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.