## packages
library(pacman); options(nwarnings = 1000)
# need to install from GitHub because not maintained on CRAN
pkgs <- c("plyr", "MortalityLaws",
"haven", # used to read in CPS
"blsR", # used to read in JOLTS
"tabulator", # used to tabulate as I debug
"data.table", # used because I like data.table
"magrittr","lubridate", "remotes",
"rstan", "dplyr", "spatstat.utils", "EnvStats",
"DemoTools", # used as inspiration
"readxl", "writexl", "stats", "MortalityTables", "stringr", "tidytable",
# used because I like data.table manipulations
"ggalt", "patchwork", "ungroup", "here", "devtools")
p_load(char = pkgs)
## define directories - raw data directory, processed data directory, code directory
{
# PECMLD
base_dir <- "/Users/msl/Documents/CompletedCoursework&Projects/PECMOD/PageProofs/ReplicationKit"
setwd(base_dir)
here::i_am("./Script/main.R")
# data.table::update_dev_pkg()
# you will need data.table 1.14.9 for its environmental effects.
set.seed(1)
}
## 0. read in utility functions
source(here("Script", "functions.R"))
## 1. make hire statistics from U.S. JOLTS, job tenures from IPUMS CPS Job Tenure
## Supplement, job displacements from IPUMS CPS Displaced Workers Supplement
source(here("Script", "make_dataset.R"))
## 2. single decrement population-level expected job duration calculations followed
## by multiple decrement and associated single-decrement tenure tables for population
source(here("Script", "analysis.R"))
## 3. make tables
source(here("Script", "tables.R"))
