R/phase2_onet.R

Defines functions phase2_onet

Documented in phase2_onet

#' Construct O-NET employment data
#'
#' This function reads in OES employment data from 2004 to 2019. It then converts SOC-2000 data to SOC-2010 and then maps the employment totals to O-NET SOC-2010,
#' so that employment can be used as weights for constructing O-NET information for UK SOC codes.
#'
#'  A list containing four data frames:
#' @return `onetsoc2010code` - O-NET SOC-2010 occupation indicator code
#' @return `datalevel` - dummy variable equal to 1 if the occupation is a data level occupation
#' @return `year` - year
#' @return `onet_oes_emp` - employment estimate for the occupation/year
#'
#' @export
phase2_onet <- function() {

print("Phase 2 of 6: Now Reading in and Cleaning Employment Data")


  onet_oes_merged <- merge(oes,onet_to_oes,by="occ_code") %>%
    mutate(empl = tot_emp_imp*weight) %>%
    select(c("onetsoc2010code","datalevel","empl","year")) %>%
    rename("onetsoc2010code"="onetsoc2010code",
           "datalevel"="datalevel",
           "onet_oes_emp"="empl",
           "year"="year")

  return(onet_oes_merged)

}
djmorris1989/onetmappinguk documentation built on June 14, 2020, 10:04 a.m.