R/read_erp.R
read_erp.Rd
read_erp()
uses the read_abs()
function to download, import,
and tidy the Estimated Residential Population from the ABS. It allows the user
to specify age, sex and states/territories of interest. It returns a tibble
containing five columns: the date, the age range, sex and states that the ERP
corresponds to. This makes joining the ERP to another dataframe easy.
read_erp(
age_range = 0:100,
sex = "Persons",
states = c("Australia", "New South Wales", "Victoria", "Queensland", "South Australia",
"Western Australia", "Tasmania", "Northern Territory",
"Australian Capital Territory"),
path = Sys.getenv("R_READABS_PATH", unset = tempdir()),
show_progress_bars = TRUE,
check_local = FALSE,
retain_files = FALSE
)
numeric; default is "0:100". A vector containing ages in single years for which an ERP is sought. The ABS top-code ages at 100.
character; default is "Persons". Other values are "Male" and "Female". Multiple values allowed.
character; default is "Australia". Other values are the full or abbreviated names of the states and self-governing territories. Multiple values allowed.
character; default is "data/ABS". Only used if retain_files is set to TRUE. Local directory in which to save downloaded ABS time series spreadsheets.
logical; TRUE by default. If set to FALSE, progress bars will not be shown when ABS spreadsheets are downloading.
logical; FALSE by default. See ?read_abs
.
logical; FALSE by default. When TRUE, the spreadsheets downloaded from the ABS website will be saved in the directory specified with 'path'.
# \donttest{
# Create a tibble called 'erp' that contains the ERP index
# numbers for 30 June each year for Australia.
erp <- read_erp()
#> Finding URLs for tables corresponding to ABS catalogue 3101.0
#> Attempting to download files from catalogue 3101.0, National, state and territory population
#> Extracting data from downloaded spreadsheets
#> Tidying data from imported ABS spreadsheets
# }