#' @title Get ABS Labour Force Data from DJSIR Database
#'
#' @param series character vector of required series. If missing
#' all data is returned from the DB
#'
#'
#' @return data.frame
#' @export
#'
#' @examples
#' \dontrun{
#' get_labourforce_db("15-24_females_unemployment rate")
#' }
get_labourforce_db <- function(series = NULL){
con <- djpr_connect()
if (is.null(series)) {
abs_labour_force <- dplyr::tbl(con, 'abs_labour_force')
} else {
abs_labour_force <- dplyr::tbl(con, 'abs_labour_force') |>
dplyr::filter(series_id %in% !!series)
}
data <- abs_labour_force |>
dplyr::left_join(
dplyr::tbl(con, 'abs_lfs_lookup'), by = 'series_id'
) |>
dplyr::collect()
DBI::dbDisconnect(con)
td <- difftime(lubridate::now(), unique(data$timestamp.x), units = 'days')
if (td > 1) warning("The Database has not been refreshed in the last Day")
if (!all(series %in% data$series_id)) warning("Not all series IDs could be found")
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.