Skip to contents
library(tibble)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tidyr)
library(stringr)
library(readr)
library(kableExtra)
#> 
#> Attaching package: 'kableExtra'
#> The following object is masked from 'package:dplyr':
#> 
#>     group_rows

library(PrjCompPPTS)
# If resave outputs to data, only do this during development
# Latex output file
verbose <- TRUE
bl_tex_save <- FALSE
spt_path_res <- file.path("..", "res-tab", fsep = .Platform$file.sep)
spn_tex_out <- file.path(spt_path_res, "tab_weea_lrce.tex", fsep = .Platform$file.sep)

Implement PrjCompPPTS-11,summaries for Western Europe and East Asia stats.

Generate input file

Load prepped all location level files

Load file with interpolated data.

# Locaiton codes
ppts_code_wrk <- ppts_country_code
# We load in the global population data.
df_ppts <- ppts_easia_weuro_world_pchg

Run PrjCompPPTS functions

Run functions to generate FLR, FPC, and FEL files. Run FLR.

# country list
ar_st_country_names <- c(
  "CHN", "TWN", "JPN", "KOR",
  "AUT", "DEU", "FRA", "NLD", "CHE"
)
df_ppts_sel <- df_ppts %>%
  filter(location_code %in% ar_st_country_names)
# Generate PLR
df_flr_weea <- PrjCompPPTS::ff_ppts_lrce_flr(
  df_ppts_sel,
  st_year_bins_type = "1940t2020i01",
  ar_it_years = c(
    1960, 1970, 1980, 1990, 2000, 2010, 2020
  ),
  verbose = TRUE
)
#> F-713479, S1
#> [1] 1960 1970 1980 1990 2000 2010 2020
#> F-713479, S2
#> dim of youth wide file: 52
#> dim of youth wide file: 7
#> F-713479, S2
#> [1] "var_rat_y2t"
#> [1] "var_lvl_youthpop"
#> [1] "var_lvl_teacher"
#> dim FLR: 52
#> dim FLR: 8
#> F-713479, S2
#> [1] "var_rat_s2t"
#> [1] "var_lvl_student"
#> [1] "var_lvl_teacher"
#> dim FLR: 52
#> dim FLR: 9
#> F-713479, S2
#> [1] "var_rat_y2s"
#> [1] "var_lvl_youthpop"
#> [1] "var_lvl_school"
#> dim FLR: 52
#> dim FLR: 10
#> F-713479, S2
#> [1] "var_rat_s2s"
#> [1] "var_lvl_student"
#> [1] "var_lvl_school"
#> dim FLR: 52
#> dim FLR: 11
#> F-713479, S3
#>  [1] "location_code"    "location_level"   "year_bins"        "var_lvl_school"  
#>  [5] "var_lvl_student"  "var_lvl_teacher"  "var_lvl_youthpop" "var_rat_y2t"     
#>  [9] "var_rat_s2t"      "var_rat_y2s"      "var_rat_s2s"     
#> dim of youth wide ratio file: 52
#> dim of youth wide ratio file: 11

Run FPC.

# Generate FPC
df_fpc_weea <- PrjCompPPTS::ff_ppts_lrce_fpc(
  df_flr_weea,
  ar_it_years_chg = c(1960, 1970, 1980, 1990, 2000, 2010, 2020),
  ls_chg_years = list(
    "chg_20v60" = c(1960, 2020),
    "chg_20v70" = c(1970, 2020),
    "chg_20v80" = c(1980, 2020),
    "chg_20v90" = c(1990, 2020),
    "chg_20v00" = c(2000, 2020),
    "chg_20v10" = c(2010, 2020)
  ), verbose = TRUE
)
#> F-376864, S1
#> dim of youth wide ratio file: 395
#> dim of youth wide ratio file: 6
#> F-376864, S2
#> dim of youth wide ratio file: 395
#> dim of youth wide ratio file: 6
#> F-376864, S3
#> dim of youth wide ratio file: 144
#> dim of youth wide ratio file: 11
#> F-376864, SD3
#> [1] "chg_20v60"
#> [1] "year1960"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 12
#> F-376864, SD3
#> [1] "chg_20v70"
#> [1] "year1970"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 13
#> F-376864, SD3
#> [1] "chg_20v80"
#> [1] "year1980"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 14
#> F-376864, SD3
#> [1] "chg_20v90"
#> [1] "year1990"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 15
#> F-376864, SD3
#> [1] "chg_20v00"
#> [1] "year2000"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 16
#> F-376864, SD3
#> [1] "chg_20v10"
#> [1] "year2010"
#> [1] "year2020"
#> dim FPC: 144
#> dim FPC: 17
#> F-376864, S4
#> dim FPC: 144
#> dim FPC: 17
print(df_fpc_weea, n = 40)
#> # A tibble: 144 × 17
#>    location_code location_level vartype variable    year1960   year1970 year1980
#>    <fct>         <fct>          <chr>   <chr>          <dbl>      <dbl>    <dbl>
#>  1 AUT           country        lvl     school        4393       3.97e3   3.45e3
#>  2 AUT           country        lvl     student     516110       5.96e5   4.01e5
#>  3 AUT           country        lvl     teacher      21499       2.48e4   2.75e4
#>  4 AUT           country        lvl     youthpop   1566864       1.84e6   1.55e6
#>  5 AUT           country        rat     y2t             72.9     7.40e1   5.63e1
#>  6 AUT           country        rat     s2t             24.0     2.40e1   1.46e1
#>  7 AUT           country        rat     y2s            357.      4.62e2   4.49e2
#>  8 AUT           country        rat     s2s            117.      1.50e2   1.16e2
#>  9 CHE           country        lvl     school          NA      NA       NA     
#> 10 CHE           country        lvl     student     573052.      5.32e5   4.40e5
#> 11 CHE           country        lvl     teacher      17449.      2.09e4   2.52e4
#> 12 CHE           country        lvl     youthpop   1315049.      1.37e6   1.28e6
#> 13 CHE           country        rat     y2t             75.4     6.53e1   5.07e1
#> 14 CHE           country        rat     s2t             32.8     2.54e1   1.75e1
#> 15 CHE           country        rat     y2s             NA      NA       NA     
#> 16 CHE           country        rat     s2s             NA      NA       NA     
#> 17 CHN           country        lvl     school      726484       9.61e5   9.17e5
#> 18 CHN           country        lvl     student   93791000       1.05e8   1.46e8
#> 19 CHN           country        lvl     teacher    2693000       3.61e6   5.50e6
#> 20 CHN           country        lvl     youthpop 265641893       3.31e8   3.53e8
#> 21 CHN           country        rat     y2t             98.6     9.15e1   6.41e1
#> 22 CHN           country        rat     s2t             34.8     2.91e1   2.66e1
#> 23 CHN           country        rat     y2s            366.      3.44e2   3.84e2
#> 24 CHN           country        rat     s2s            129.      1.10e2   1.59e2
#> 25 DEU           country        lvl     school          NA      NA       NA     
#> 26 DEU           country        lvl     teacher         NA      NA       NA     
#> 27 DEU           country        lvl     youthpop        NA      NA       NA     
#> 28 DEU           country        rat     y2t             NA      NA       NA     
#> 29 DEU           country        rat     y2s             NA      NA       NA     
#> 30 DEU           country        lvl     student         NA      NA       NA     
#> 31 DEU           country        rat     s2t             NA      NA       NA     
#> 32 DEU           country        rat     s2s             NA      NA       NA     
#> 33 FRA           country        lvl     school          NA      NA        6.07e4
#> 34 FRA           country        lvl     student         NA      NA        6.13e6
#> 35 FRA           country        lvl     teacher         NA      NA        2.92e5
#> 36 FRA           country        lvl     youthpop        NA      NA        1.24e7
#> 37 FRA           country        rat     y2t             NA      NA        4.24e1
#> 38 FRA           country        rat     s2t             NA      NA        2.10e1
#> 39 FRA           country        rat     y2s             NA      NA        2.04e2
#> 40 FRA           country        rat     s2s             NA      NA        1.01e2
#> # ℹ 104 more rows
#> # ℹ 10 more variables: year1990 <dbl>, year2000 <dbl>, year2010 <dbl>,
#> #   year2020 <dbl>, chg_20v60 <dbl>, chg_20v70 <dbl>, chg_20v80 <dbl>,
#> #   chg_20v90 <dbl>, chg_20v00 <dbl>, chg_20v10 <dbl>

Run FEL.

# Generate FEL
df_fel_weea <- PrjCompPPTS::ff_ppts_lrce_fel(
  df_fpc_weea,
  verbose = TRUE
)
#> F-307302, S1
#> dim df_fpc_base: 36
#> dim df_fpc_base: 9
#> F-307302, S2
#> dim df_fel_long: 165
#> dim df_fel_long: 5
#> F-307302, S3
#> dim df_fel_wide: 43
#> dim df_fel_wide: 7
#> F-307302, S3
#> [1] "var_elas_y2t"
#> [1] "var_chg_youthpop"
#> [1] "var_chg_teacher"
#> dim FEL: 43
#> dim FEL: 8
#> F-307302, S3
#> [1] "var_elas_s2t"
#> [1] "var_chg_student"
#> [1] "var_chg_teacher"
#> dim FEL: 43
#> dim FEL: 9
#> F-307302, S3
#> [1] "var_elas_y2s"
#> [1] "var_chg_youthpop"
#> [1] "var_chg_school"
#> dim FEL: 43
#> dim FEL: 10
#> F-307302, S3
#> [1] "var_elas_s2s"
#> [1] "var_chg_student"
#> [1] "var_chg_school"
#> dim FEL: 43
#> dim FEL: 11
#> F-307302, S4
#> dim df_fel_elas: 43
#> dim df_fel_elas: 11
#> F-307302, S4
#> dim FEL: 36
#> dim FEL: 9
print(df_fel_weea, n = 40)
#> # A tibble: 36 × 9
#>    location_code location_level variable elas_20v60 elas_20v70 elas_20v80
#>    <fct>         <fct>          <chr>         <dbl>      <dbl>      <dbl>
#>  1 AUT           country        y2t        -0.245     -0.596     -0.480  
#>  2 AUT           country        s2t        -0.445     -0.829     -0.378  
#>  3 AUT           country        y2s         0.573      1.24       1.35   
#>  4 AUT           country        s2s         1.04       1.73       1.06   
#>  5 CHE           country        y2t        -0.00822   -0.0340     0.00839
#>  6 CHE           country        s2t        -0.0349    -0.00148    0.174  
#>  7 CHE           country        y2s        NA         NA         NA      
#>  8 CHE           country        s2s        NA         NA         NA      
#>  9 CHN           country        y2t        -0.0427    -0.313     -1.71   
#> 10 CHN           country        s2t         0.103      0.0240    -1.57   
#> 11 CHN           country        y2s         0.0757     0.292      0.352  
#> 12 CHN           country        s2s        -0.183     -0.0224     0.322  
#> 13 DEU           country        y2t        NA         NA         NA      
#> 14 DEU           country        y2s        NA         NA         NA      
#> 15 DEU           country        s2t        NA         NA         NA      
#> 16 DEU           country        s2s        NA         NA         NA      
#> 17 FRA           country        y2t        NA         NA         -0.378  
#> 18 FRA           country        s2t        NA         NA         -1.13   
#> 19 FRA           country        y2s        NA         NA          0.149  
#> 20 FRA           country        s2s        NA         NA          0.443  
#> 21 JPN           country        y2t        -2.59      -2.50       4.45   
#> 22 JPN           country        s2t        -2.91      -2.27       4.82   
#> 23 JPN           country        y2s         1.63       1.75       1.99   
#> 24 JPN           country        s2s         1.83       1.58       2.15   
#> 25 KOR           country        y2t        NA         -0.594     -0.842  
#> 26 KOR           country        s2t        NA         -0.609     -0.888  
#> 27 KOR           country        y2s        NA        -19.4        8.77   
#> 28 KOR           country        s2s        NA        -19.9        9.26   
#> 29 NLD           country        y2s        NA         NA         NA      
#> 30 NLD           country        s2s        NA         NA         NA      
#> 31 NLD           country        y2t        NA         NA         NA      
#> 32 NLD           country        s2t        NA         NA         NA      
#> 33 TWN           country        y2t        NA         NA         -1.20   
#> 34 TWN           country        s2t        NA         NA         -1.18   
#> 35 TWN           country        y2s        NA         NA         -5.78   
#> 36 TWN           country        s2s        NA         NA         -5.68   
#> # ℹ 3 more variables: elas_20v90 <dbl>, elas_20v00 <dbl>, elas_20v10 <dbl>

Merge FPC and FEL, country and group

Now we combine the level and change information from FPC with the elasticity results from FEL.

We have the LRCE file, level, ratio, change, and elasticity.

df_lrce_weea <- df_fpc_weea %>% left_join(
  df_fel_weea %>% mutate(vartype = "rat"),
  by = (c(
    "location_code" = "location_code",
    "location_level" = "location_level",
    "variable" = "variable",
    "vartype" = "vartype"
  ))
)
print(glue::glue("dim df_lrce_weea: {dim(df_lrce_weea)}"))
#> dim df_lrce_weea: 144
#> dim df_lrce_weea: 23

Finally, merge in country key info to FPC, country-level information.

df_lrce_weea <- df_lrce_weea %>%
  left_join(
    ppts_code_wrk %>%
      select(
        location_name, location_code,
        location_region_group, location_region_group_code
      ),
    by = c("location_code" = "location_code")
  ) %>%
  # mutate(location_name_full = paste0(location_name, " (", location_code, ")")) %>%
  mutate(location_name_full = paste0(location_name)) %>%
  select(-location_name) %>%
  select(location_name_full, location_region_group, everything()) %>%
  arrange(location_region_group_code, location_name_full)

Global Population Table

Prep Table inputs

First, select level and percentage changes year by year for four variables. Also get ratio and elasticities.

# level
df_lvl_weea <- df_lrce_weea %>%
  filter(vartype == "lvl") %>%
  select(location_name_full, variable, contains("year"))
# change
df_chg_weea <- df_lrce_weea %>%
  filter(vartype == "lvl") %>%
  select(location_name_full, variable, contains("chg"))
# ratio
df_rat_weea <- df_lrce_weea %>%
  filter(vartype == "rat") %>%
  select(location_name_full, variable, contains("year"))
# elasticity
df_elas_weea <- df_lrce_weea %>%
  filter(vartype == "rat") %>%
  select(location_name_full, variable, contains("elas"))

Second, reshape time variables from each table above from wide to long.

# level file
df_lvl_weea_long <- df_lvl_weea %>%
  pivot_longer(
    cols = starts_with("year"),
    names_to = c("yearset"),
    names_pattern = paste0("year(.*)"),
    values_to = "stats"
  ) %>%
  mutate(type = "1lvl")
# change file
df_chg_weea_long <- df_chg_weea %>%
  pivot_longer(
    cols = starts_with("chg"),
    names_to = c("yearset"),
    names_pattern = paste0("chg_(.*)"),
    values_to = "stats"
  ) %>%
  mutate(type = "2chg")
# ratio file
df_rat_weea_long <- df_rat_weea %>%
  pivot_longer(
    cols = starts_with("year"),
    names_to = c("yearset"),
    names_pattern = paste0("year(.*)"),
    values_to = "stats"
  ) %>%
  mutate(type = "3rat")
# elasticity file
df_elas_weea_long <- df_elas_weea %>%
  pivot_longer(
    cols = starts_with("elas"),
    names_to = c("yearset"),
    names_pattern = paste0("elas_(.*)"),
    values_to = "stats"
  ) %>%
  mutate(type = "4elas")

Third, combine long files, and convert countries to columns, reshape to wide.

# combine all long files
df_weea_long_jnt <- bind_rows(
  df_lvl_weea_long,
  df_chg_weea_long,
  df_rat_weea_long,
  df_elas_weea_long
)
# country name modification
df_weea_long_jnt <- df_weea_long_jnt %>%
  mutate(
    location_name_full =
      ifelse(location_name_full == "Korea, Rep.", "Korea", location_name_full)
  )
# reshape long to wide
df_weea_wide <- df_weea_long_jnt %>%
  pivot_wider(
    id_cols = c("type", "variable", "yearset"),
    names_from = location_name_full,
    names_prefix = "j_",
    values_from = stats
  )

Fourth, organize columns, and generate four subsets.

# Select variables
tab3_weea <- df_weea_wide %>%
  select(
    type, variable, yearset,
    j_China, j_Japan, j_Korea, j_Taiwan,
    j_Austria, j_Germany, j_France, j_Netherlands, j_Switzerland
  )
# Four variables
tab3_weea_lvl <- tab3_weea %>% filter(type == "1lvl")
tab3_weea_chg <- tab3_weea %>% filter(type == "2chg")
tab3_weea_rat <- tab3_weea %>% filter(type == "3rat")
tab3_weea_elas <- tab3_weea %>% filter(type == "4elas")

Fifth, format each type of variables separately.

# Format variables, level in millions
tab3_weea_lvl_school <- tab3_weea_lvl %>%
  filter(variable == "school") %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(. / 1000, 1),
        nsmall = 0, big.mark = ","
      )
    ))
  )
tab3_weea_lvl_teacher <- tab3_weea_lvl %>%
  filter(variable == "teacher") %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(. / 1000, 1),
        nsmall = 0, big.mark = ","
      )
    ))
  )
tab3_weea_lvl_youth <- tab3_weea_lvl %>%
  filter(variable == "youthpop") %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(. / 1000000, 1),
        nsmall = 0, big.mark = ","
      )
    ))
  )
tab3_weea_lvl_student <- tab3_weea_lvl %>%
  filter(variable == "student") %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(. / 1000000, 1),
        nsmall = 0, big.mark = ","
      )
    ))
  )
# Change in percent
tab3_weea_chg <- tab3_weea_chg %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(., 2) * 100,
        nsmall = 0,
        big.mark = ","
      ),
      "%"
    ))
  )
# Change in ratio
tab3_weea_rat <- tab3_weea_rat %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(., 0), nsmall = 0, big.mark = ",")
    ))
  )
# Change in ratio
tab3_weea_elas <- tab3_weea_elas %>%
  mutate_at(
    vars(contains("j_")),
    list(~ paste0(
      format(round(., 2), nsmall = 0, big.mark = ",")
    ))
  )

Sixth, combine all four stats again, now that formatting is done.

# combine
tab3_weea_jnt <- bind_rows(
  tab3_weea_lvl_school,
  tab3_weea_lvl_teacher,
  tab3_weea_lvl_youth,
  tab3_weea_lvl_student,
  tab3_weea_chg,
  tab3_weea_rat,
  tab3_weea_elas
)
# replace variable names for sorting
tab3_weea_jnt <- tab3_weea_jnt %>%
  mutate(variable_sort = case_when(
    variable == "school" ~ "1school",
    variable == "teacher" ~ "2teacher",
    variable == "student" ~ "3student",
    variable == "youthpop" ~ "4youthpop",
    variable == "s2s" ~ "1s2s",
    variable == "y2s" ~ "2y2s",
    variable == "s2t" ~ "3s2t",
    variable == "y2t" ~ "4y2t"
  ))
# Year sorting
tab3_weea_jnt <- tab3_weea_jnt %>%
  mutate(yearset = case_when(
    yearset == "20v00" ~ "2020 vs 2000",
    yearset == "20v10" ~ "2020 vs 2010",
    yearset == "20v60" ~ "2020 vs 1960",
    yearset == "20v70" ~ "2020 vs 1970",
    yearset == "20v80" ~ "2020 vs 1980",
    yearset == "20v90" ~ "2020 vs 1990",
    TRUE ~ yearset
  ))
# replace NAs
tab3_weea_jnt <- tab3_weea_jnt %>%
  mutate_at(vars(starts_with("j_")), ~ str_replace(., "NA%", "")) %>%
  mutate_at(vars(starts_with("j_")), ~ str_replace(., "NA", ""))

print(tab3_weea_jnt, n = 200)
#> # A tibble: 104 × 13
#>     type  variable yearset  j_China j_Japan j_Korea j_Taiwan j_Austria j_Germany
#>     <chr> <chr>    <chr>    <chr>   <chr>   <chr>   <chr>    <chr>     <chr>    
#>   1 1lvl  school   1960     "726.5" "26.9"  " "     " "      "4.4"     "  "     
#>   2 1lvl  school   1970     "961.1" "24.8"  "6.0"   " "      "4.0"     "  "     
#>   3 1lvl  school   1980     "917.3" "24.9"  "6.5"   "2.4"    "3.5"     "  "     
#>   4 1lvl  school   1990     "766.1" "24.8"  "6.3"   "2.5"    "3.4"     "18.0"   
#>   5 1lvl  school   2000     "553.6" "24.1"  "5.3"   "2.6"    "3.4"     "17.3"   
#>   6 1lvl  school   2010     "257.4" "22.0"  "5.9"   "2.7"    "3.2"     "16.3"   
#>   7 1lvl  school   2020     "158.0" "19.5"  "6.1"   "2.6"    "3.0"     "15.4"   
#>   8 1lvl  teacher  1960     "2,693… "360.7" "   "   "   "    "21.5"    "   "    
#>   9 1lvl  teacher  1970     "3,612… "367.9" "101.1" "   "    "24.8"    "   "    
#>  10 1lvl  teacher  1980     "5,499… "468.0" "119.1" " 69.1"  "27.5"    "   "    
#>  11 1lvl  teacher  1990     "5,582… "444.2" "136.8" " 82.6"  "29.4"    "181.0"  
#>  12 1lvl  teacher  2000     "5,860… "407.6" "140.0" "101.6"  "33.9"    "215.4"  
#>  13 1lvl  teacher  2010     "5,617… "419.8" "176.8" " 99.6"  "32.6"    "228.4"  
#>  14 1lvl  teacher  2020     "6,434… "422.6" "189.3" " 97.0"  "37.3"    "237.8"  
#>  15 1lvl  youthpop 1960     "265.6" "28.2"  "  "    " "      "1.6"     "  "     
#>  16 1lvl  youthpop 1970     "330.7" "24.9"  "13.5"  " "      "1.8"     "  "     
#>  17 1lvl  youthpop 1980     "352.6" "27.5"  "12.9"  "5.7"    "1.5"     "  "     
#>  18 1lvl  youthpop 1990     "324.5" "22.8"  "10.9"  "5.5"    "1.3"     "12.8"   
#>  19 1lvl  youthpop 2000     "313.0" "18.8"  " 9.7"  "4.7"    "1.3"     "12.9"   
#>  20 1lvl  youthpop 2010     "249.6" "17.1"  " 8.0"  "3.6"    "1.2"     "11.1"   
#>  21 1lvl  youthpop 2020     "249.9" "15.7"  " 6.5"  "3.0"    "1.3"     "11.6"   
#>  22 1lvl  student  1960     " 93.8" "12.6"  " "     " "      "0.5"     " "      
#>  23 1lvl  student  1970     "105.3" " 9.5"  "5.7"   " "      "0.6"     " "      
#>  24 1lvl  student  1980     "146.3" "11.8"  "5.7"   "2.2"    "0.4"     " "      
#>  25 1lvl  student  1990     "122.4" " 9.4"  "4.9"   "2.4"    "0.4"     " "      
#>  26 1lvl  student  2000     "130.1" " 7.4"  "4.0"   "1.9"    "0.4"     "3.4"    
#>  27 1lvl  student  2010     " 99.4" " 7.0"  "3.3"   "1.5"    "0.3"     "2.8"    
#>  28 1lvl  student  2020     "107.3" " 6.3"  "2.7"   "1.2"    "0.3"     "2.8"    
#>  29 2chg  school   2020 vs… "-78%"  "-27%"  " "     " "      "-31%"    " "      
#>  30 2chg  school   2020 vs… "-84%"  "-21%"  "  3%"  " "      "-24%"    " "      
#>  31 2chg  school   2020 vs… "-83%"  "-22%"  " -6%"  "  8%"   "-13%"    " "      
#>  32 2chg  school   2020 vs… "-79%"  "-21%"  " -3%"  "  6%"   "-11%"    "-14%"   
#>  33 2chg  school   2020 vs… "-71%"  "-19%"  " 16%"  "  1%"   "-10%"    "-11%"   
#>  34 2chg  school   2020 vs… "-39%"  "-11%"  "  5%"  " -1%"   " -5%"    " -5%"   
#>  35 2chg  student  2020 vs… " 14%"  "-50%"  " "     " "      "-33%"    " "      
#>  36 2chg  student  2020 vs… "  2%"  "-34%"  "-53%"  " "      "-42%"    " "      
#>  37 2chg  student  2020 vs… "-27%"  "-47%"  "-52%"  "-47%"   "-13%"    " "      
#>  38 2chg  student  2020 vs… "-12%"  "-33%"  "-45%"  "-50%"   " -7%"    " "      
#>  39 2chg  student  2020 vs… "-18%"  "-14%"  "-33%"  "-39%"   "-12%"    "-15%"   
#>  40 2chg  student  2020 vs… "  8%"  "-10%"  "-18%"  "-23%"   "  6%"    "  0%"   
#>  41 2chg  teacher  2020 vs… "139%"  " 17%"  " "     " "      " 73%"    " "      
#>  42 2chg  teacher  2020 vs… " 78%"  " 15%"  " 87%"  " "      " 50%"    " "      
#>  43 2chg  teacher  2020 vs… " 17%"  "-10%"  " 59%"  " 40%"   " 35%"    " "      
#>  44 2chg  teacher  2020 vs… " 15%"  " -5%"  " 38%"  " 17%"   " 27%"    " 31%"   
#>  45 2chg  teacher  2020 vs… " 10%"  "  4%"  " 35%"  " -5%"   " 10%"    " 10%"   
#>  46 2chg  teacher  2020 vs… " 15%"  "  1%"  "  7%"  " -3%"   " 14%"    "  4%"   
#>  47 2chg  youthpop 2020 vs… " -6%"  "-44%"  " "     " "      "-18%"    " "      
#>  48 2chg  youthpop 2020 vs… "-24%"  "-37%"  "-52%"  " "      "-30%"    " "      
#>  49 2chg  youthpop 2020 vs… "-29%"  "-43%"  "-50%"  "-48%"   "-17%"    " "      
#>  50 2chg  youthpop 2020 vs… "-23%"  "-31%"  "-40%"  "-46%"   " -1%"    " -9%"   
#>  51 2chg  youthpop 2020 vs… "-20%"  "-16%"  "-33%"  "-37%"   " -5%"    "-10%"   
#>  52 2chg  youthpop 2020 vs… "  0%"  " -8%"  "-19%"  "-18%"   "  4%"    "  5%"   
#>  53 3rat  y2t      1960     "   99" "   78" "   "   "   "    " 73"     " "      
#>  54 3rat  y2t      1970     "   92" "   68" "  134" "   "    " 74"     " "      
#>  55 3rat  y2t      1980     "   64" "   59" "  108" "   83"  " 56"     " "      
#>  56 3rat  y2t      1990     "   58" "   51" "   80" "   67"  " 44"     " 71"    
#>  57 3rat  y2t      2000     "   53" "   46" "   69" "   46"  " 40"     " 60"    
#>  58 3rat  y2t      2010     "   44" "   41" "   45" "   36"  " 38"     " 49"    
#>  59 3rat  y2t      2020     "   39" "   37" "   34" "   31"  " 34"     " 49"    
#>  60 3rat  s2t      1960     "   35" "   35" "   "   "   "    " 24"     " "      
#>  61 3rat  s2t      1970     "   29" "   26" "   57" "   "    " 24"     " "      
#>  62 3rat  s2t      1980     "   27" "   25" "   48" "   32"  " 15"     " "      
#>  63 3rat  s2t      1990     "   22" "   21" "   36" "   29"  " 13"     " "      
#>  64 3rat  s2t      2000     "   22" "   18" "   29" "   19"  " 12"     " 16"    
#>  65 3rat  s2t      2010     "   18" "   17" "   19" "   15"  " 10"     " 12"    
#>  66 3rat  s2t      2020     "   17" "   15" "   14" "   12"  "  9"     " 12"    
#>  67 3rat  y2s      1960     "  366" "1,050" "   "   "   "    "357"     " "      
#>  68 3rat  y2s      1970     "  344" "1,006" "2,265" "   "    "462"     " "      
#>  69 3rat  y2s      1980     "  384" "1,104" "1,990" "2,364"  "449"     " "      
#>  70 3rat  y2s      1990     "  424" "  919" "1,721" "2,222"  "384"     "709"    
#>  71 3rat  y2s      2000     "  565" "  778" "1,840" "1,809"  "401"     "746"    
#>  72 3rat  y2s      2010     "  970" "  777" "1,363" "1,362"  "388"     "681"    
#>  73 3rat  y2s      2020     "1,582" "  802" "1,062" "1,126"  "426"     "751"    
#>  74 3rat  s2s      1960     "  129" "  469" "   "   "   "    "117"     " "      
#>  75 3rat  s2s      1970     "  110" "  383" "  964" "   "    "150"     " "      
#>  76 3rat  s2s      1980     "  159" "  474" "  872" "  920"  "116"     " "      
#>  77 3rat  s2s      1990     "  160" "  378" "  769" "  947"  "110"     " "      
#>  78 3rat  s2s      2000     "  235" "  306" "  763" "  741"  "117"     "194"    
#>  79 3rat  s2s      2010     "  386" "  318" "  564" "  571"  "103"     "174"    
#>  80 3rat  s2s      2020     "  679" "  323" "  440" "  446"  "115"     "184"    
#>  81 4elas y2t      2020 vs… "-0.04" " -2.5… "    "  "    "   "-0.24"   "   "    
#>  82 4elas y2t      2020 vs… "-0.31" " -2.5… " -0.5… "    "   "-0.60"   "   "    
#>  83 4elas y2t      2020 vs… "-1.71" "  4.4… " -0.8… " -1.20" "-0.48"   "   "    
#>  84 4elas y2t      2020 vs… "-1.51" "  6.4… " -1.0… " -2.66" "-0.04"   "-0.29"  
#>  85 4elas y2t      2020 vs… "-2.06" " -4.4… " -0.9… "  8.14" "-0.46"   "-0.96"  
#>  86 4elas y2t      2020 vs… " 0.01" "-12.7… " -2.6… "  6.99" " 0.31"   " 1.12"  
#>  87 4elas s2t      2020 vs… " 0.10" " -2.9… "    "  "    "   "-0.44"   "   "    
#>  88 4elas s2t      2020 vs… " 0.02" " -2.2… " -0.6… "    "   "-0.83"   "   "    
#>  89 4elas s2t      2020 vs… "-1.57" "  4.8… " -0.8… " -1.18" "-0.38"   "   "    
#>  90 4elas s2t      2020 vs… "-0.81" "  6.7… " -1.1… " -2.88" "-0.24"   "   "    
#>  91 4elas s2t      2020 vs… "-1.79" " -3.9… " -0.9… "  8.60" "-1.15"   "-1.47"  
#>  92 4elas s2t      2020 vs… " 0.54" "-14.9… " -2.5… "  8.73" " 0.42"   " 0.04"  
#>  93 4elas y2s      2020 vs… " 0.08" "  1.6… "    "  "    "   " 0.57"   "   "    
#>  94 4elas y2s      2020 vs… " 0.29" "  1.7… "-19.4… "    "   " 1.24"   "   "    
#>  95 4elas y2s      2020 vs… " 0.35" "  1.9… "  8.7… " -5.78" " 1.35"   "   "    
#>  96 4elas y2s      2020 vs… " 0.29" "  1.4… " 11.9… " -8.01" " 0.10"   " 0.64"  
#>  97 4elas y2s      2020 vs… " 0.28" "  0.8… " -2.0… "-31.02" " 0.45"   " 0.94"  
#>  98 4elas y2s      2020 vs… " 0.00" "  0.7… " -4.0… " 16.17" "-0.89"   "-0.89"  
#>  99 4elas s2s      2020 vs… "-0.18" "  1.8… "    "  "    "   " 1.04"   "   "    
#> 100 4elas s2s      2020 vs… "-0.02" "  1.5… "-19.9… "    "   " 1.73"   "   "    
#> 101 4elas s2s      2020 vs… " 0.32" "  2.1… "  9.2… " -5.68" " 1.06"   "   "    
#> 102 4elas s2s      2020 vs… " 0.16" "  1.5… " 13.1… " -8.66" " 0.60"   "   "    
#> 103 4elas s2s      2020 vs… " 0.25" "  0.7… " -2.0… "-32.75" " 1.14"   " 1.44"  
#> 104 4elas s2s      2020 vs… "-0.20" "  0.8… " -4.0… " 20.19" "-1.22"   "-0.03"  
#> # ℹ 4 more variables: j_France <chr>, j_Netherlands <chr>, j_Switzerland <chr>,
#> #   variable_sort <chr>

Finally, count by group, generate labeling string

# Group and arrange
tab3_weea_jnt <- tab3_weea_jnt %>%
  arrange(
    type, variable_sort, yearset,
  )
# get counts
df_typevar_counts <- tab3_weea_jnt %>%
  group_by(
    type, variable_sort, variable,
  ) %>%
  summarize(group_count = n()) %>%
  ungroup() %>%
  mutate(group_count_start = cumsum(group_count) - group_count + 1) %>%
  mutate(group_count_end = cumsum(group_count)) %>%
  select(group_count_start, group_count_end, everything())
#> `summarise()` has grouped output by 'type', 'variable_sort'. You can override
#> using the `.groups` argument.
# Generate group names
df_typevar_counts <- df_typevar_counts %>%
  mutate(type_lab = case_when(
    type == "1lvl" ~ "Number of",
    type == "2chg" ~ "Percentage change in",
    type == "3rat" ~ "Ratio",
    type == "4elas" ~ "Elasticity"
  )) %>%
  mutate(variable_lab = case_when(
    (type == "1lvl" & variable == "school") ~ "schools (1000s)",
    (type == "1lvl" & variable == "teacher") ~ "teachers (1000s)",
    (type == "1lvl" & variable == "student") ~ "students (mil.)",
    (type == "1lvl" & variable == "youthpop") ~ "youth 0-14 (mil.)",
    (type == "2chg" & variable == "school") ~ "schools",
    (type == "2chg" & variable == "teacher") ~ "teachers",
    (type == "2chg" & variable == "student") ~ "students",
    (type == "2chg" & variable == "youthpop") ~ "youth 0-14",
    (type == "3rat" & variable == "s2s") ~ "Student/School",
    (type == "3rat" & variable == "y2s") ~ "Youth/School",
    (type == "3rat" & variable == "s2t") ~ "Student/Teacher",
    (type == "3rat" & variable == "y2t") ~ "Youth/Teacher",
    (type == "4elas" & variable == "s2s") ~ "$\\Delta$\\%Student/$\\Delta$\\%School",
    (type == "4elas" & variable == "y2s") ~ "$\\Delta$\\%Youth/$\\Delta$\\%School",
    (type == "4elas" & variable == "s2t") ~ "$\\Delta$\\%Student/$\\Delta$\\%Teacher",
    (type == "4elas" & variable == "y2t") ~ "$\\Delta$\\%Youth/$\\Delta$\\%Teacher"
  )) %>%
  unite(row_name, type_lab:variable_lab, sep = " ")
# print
print(df_typevar_counts, n = 100)
#> # A tibble: 16 × 7
#>    group_count_start group_count_end type  variable_sort variable group_count
#>                <dbl>           <int> <chr> <chr>         <chr>          <int>
#>  1                 1               7 1lvl  1school       school             7
#>  2                 8              14 1lvl  2teacher      teacher            7
#>  3                15              21 1lvl  3student      student            7
#>  4                22              28 1lvl  4youthpop     youthpop           7
#>  5                29              34 2chg  1school       school             6
#>  6                35              40 2chg  2teacher      teacher            6
#>  7                41              46 2chg  3student      student            6
#>  8                47              52 2chg  4youthpop     youthpop           6
#>  9                53              59 3rat  1s2s          s2s                7
#> 10                60              66 3rat  2y2s          y2s                7
#> 11                67              73 3rat  3s2t          s2t                7
#> 12                74              80 3rat  4y2t          y2t                7
#> 13                81              86 4elas 1s2s          s2s                6
#> 14                87              92 4elas 2y2s          y2s                6
#> 15                93              98 4elas 3s2t          s2t                6
#> 16                99             104 4elas 4y2t          y2t                6
#> # ℹ 1 more variable: row_name <chr>

Generate table

Now we generate the table.

ar_st_kableformat <- c("latex", "html")
for (st_kableformat in ar_st_kableformat) {
  # j_China, j_Japan, j_Korea, j_Taiwan,
  # j_Austria, j_Germany, j_France, j_Netherlands, j_Switzerland
  # Column names
  ar_st_col_names <- c(
    "Years",
    "China",
    "Japan",
    "Korea",
    "Taiwan",
    "Austria",
    "Germany",
    "France",
    "Netherlands",
    "Switzerland"
  )
  # Define column groups, grouping the names above
  # =1/3/2 are number of columns group title covers
  ar_st_col_groups <- c(
    " " = 1,
    "East Asia" = 4,
    "Western Europe" = 5
  )

  # Second, we construct main table, and add styling.
  bk_weea <- kbl(
    tab3_weea_jnt %>%
      select(-type, -variable, -variable_sort),
    format = st_kableformat,
    label = "main:tab:weaa:pop:teachers:schools",
    # escape = F,
    linesep = "",
    booktabs = T,
    longtable = T,
    align = "c",
    caption = "East Asia and Western Europe: Schools, Teachers, Students, and Youth",
    col.names = ar_st_col_names
  ) %>%
    # see https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_html.html#Bootstrap_table_classes
    kable_styling(
      bootstrap_options = c("striped", "hover", "condensed", "responsive"),
      full_width = F, position = "left"
    )

  # Third, we add in column groups.
  bk_weea <- bk_weea %>% add_header_above(ar_st_col_groups)

  # Fourth, we add in row groups.
  for (it_group in seq(1, dim(df_typevar_counts)[1])) {
    # Reion full name info
    st_loc <- as.character(df_typevar_counts[[it_group, "row_name"]])

    # groups start and end
    it_group_count_start <- df_typevar_counts[[it_group, "group_count_start"]]
    it_group_count_end <- df_typevar_counts[[it_group, "group_count_end"]]

    # Add to table
    bk_weea <- bk_weea %>%
      pack_rows(
        st_loc, it_group_count_start, it_group_count_end,
        latex_gap_space = "1em",
        latex_align = "c",
        hline_after = TRUE
      )
  }

  # Fifth, column formatting.
  fl_width_country <- 1.5
  st_width_country <- paste0(fl_width_country, "cm")
  bk_weea <- bk_weea %>%
    column_spec(1, width = st_width_country) %>%
    column_spec(2:10, width = "1.0cm")

  # Final adjustments
  # Headings on all pages, note use `sub` to replace first midrule
  st_headend <- paste0(
    "\\midrule\\endhead\n",
    "\\addlinespace[0.2em]\\hline\\addlinespace[0.2em]\n",
    "\\multicolumn{10}{r}{\\emph{Continued on next page}}\\\\\n",
    "\\endfoot\\endlastfoot"
  )
  bk_weea <- sub(bk_weea,
    pattern = "\\midrule", replacement = st_headend,
    fixed = TRUE
  )
  # country-names left-align
  bk_weea <- gsub(bk_weea,
    pattern = paste0("\\centering\\arraybackslash}p{", st_width_country, "}"),
    replacement = paste0("\\raggedright\\arraybackslash}p{", st_width_country, "}"),
    fixed = TRUE
  )
  # midrule replacing hline
  bk_weea <- gsub(bk_weea,
    pattern = "hline",
    replacement = "midrule", fixed = TRUE
  )

  # Sixth, display.
  # pl_bk_asset_count <- bk_asset_count %>% as_image()
  if (st_kableformat == "html") {
    print(dim(bk_weea))
  } else {
    if (bl_tex_save) {
      fileConn <- file(spn_tex_out)
      writeLines(bk_weea, fileConn)
      close(fileConn)
      if (verbose) {
        print(glue::glue("F-945386, S1"))
        print(glue::glue("Latex saved: {spn_tex_out}"))
      }
    }
  }
}
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> Warning in pack_rows(., st_loc, it_group_count_start, it_group_count_end, : latex_align parameter is not used in HTML Mode,
#>                                     use label_row_css instead.
#> NULL
bk_weea
East Asia and Western Europe: Schools, Teachers, Students, and Youth
East Asia
Western Europe
Years China Japan Korea Taiwan Austria Germany France Netherlands Switzerland
Number of schools (1000s)
1960 726.5 26.9 4.4
1970 961.1 24.8 6.0 4.0
1980 917.3 24.9 6.5 2.4 3.5 60.7
1990 766.1 24.8 6.3 2.5 3.4 18.0 56.7 9.3
2000 553.6 24.1 5.3 2.6 3.4 17.3 53.0 7.8
2010 257.4 22.0 5.9 2.7 3.2 16.3 49.0 7.5 4.5
2020 158.0 19.5 6.1 2.6 3.0 15.4 45.1 6.7 4.6
Number of teachers (1000s)
1960 2,693.0 360.7 21.5 17.4
1970 3,612.0 367.9 101.1 24.8 20.9
1980 5,499.0 468.0 119.1 69.1 27.5 291.5 25.2
1990 5,582.0 444.2 136.8 82.6 29.4 181.0 309.9 30.4
2000 5,860.0 407.6 140.0 101.6 33.9 215.4 317.7 131.7 36.6
2010 5,617.0 419.8 176.8 99.6 32.6 228.4 316.1 182.0 44.1
2020 6,434.2 422.6 189.3 97.0 37.3 237.8 321.0 137.3 54.8
Number of students (mil.)
1960 93.8 12.6 0.5 0.6
1970 105.3 9.5 5.7 0.6 0.5
1980 146.3 11.8 5.7 2.2 0.4 6.1 0.4
1990 122.4 9.4 4.9 2.4 0.4 5.8 1.5 0.4
2000 130.1 7.4 4.0 1.9 0.4 3.4 5.4 1.6 0.5
2010 99.4 7.0 3.3 1.5 0.3 2.8 5.6 1.6 0.4
2020 107.3 6.3 2.7 1.2 0.3 2.8 5.4 1.5 0.5
Number of youth 0-14 (mil.)
1960 265.6 28.2 1.6 1.3
1970 330.7 24.9 13.5 1.8 1.4
1980 352.6 27.5 12.9 5.7 1.5 12.4 1.3
1990 324.5 22.8 10.9 5.5 1.3 12.8 11.7 2.7 1.2
2000 313.0 18.8 9.7 4.7 1.3 12.9 11.5 2.9 1.3
2010 249.6 17.1 8.0 3.6 1.2 11.1 12.0 2.9 1.2
2020 249.9 15.7 6.5 3.0 1.3 11.6 11.9 2.7 1.3
Percentage change in schools
2020 vs 1960 -78% -27% -31%
2020 vs 1970 -84% -21% 3% -24%
2020 vs 1980 -83% -22% -6% 8% -13% -26%
2020 vs 1990 -79% -21% -3% 6% -11% -14% -20% -29%
2020 vs 2000 -71% -19% 16% 1% -10% -11% -15% -14%
2020 vs 2010 -39% -11% 5% -1% -5% -5% -8% -11% 2%
Percentage change in teachers
2020 vs 1960 139% 17% 73% 214%
2020 vs 1970 78% 15% 87% 50% 162%
2020 vs 1980 17% -10% 59% 40% 35% 10% 117%
2020 vs 1990 15% -5% 38% 17% 27% 31% 4% 80%
2020 vs 2000 10% 4% 35% -5% 10% 10% 1% 4% 50%
2020 vs 2010 15% 1% 7% -3% 14% 4% 2% -25% 24%
Percentage change in students
2020 vs 1960 14% -50% -33% -7%
2020 vs 1970 2% -34% -53% -42% 0%
2020 vs 1980 -27% -47% -52% -47% -13% -11% 20%
2020 vs 1990 -12% -33% -45% -50% -7% -6% -2% 29%
2020 vs 2000 -18% -14% -33% -39% -12% -15% 0% -9% 12%
2020 vs 2010 8% -10% -18% -23% 6% 0% -2% -9% 22%
Percentage change in youth 0-14
2020 vs 1960 -6% -44% -18% -2%
2020 vs 1970 -24% -37% -52% -30% -5%
2020 vs 1980 -29% -43% -50% -48% -17% -4% 1%
2020 vs 1990 -23% -31% -40% -46% -1% -9% 2% 1% 10%
2020 vs 2000 -20% -16% -33% -37% -5% -10% 3% -7% 3%
2020 vs 2010 0% -8% -19% -18% 4% 5% -1% -6% 10%
Ratio Student/School
1960 129 469 117
1970 110 383 964 150
1980 159 474 872 920 116 101
1990 160 378 769 947 110 102 164
2000 235 306 763 741 117 194 103 212
2010 386 318 564 571 103 174 113 220 96
2020 679 323 440 446 115 184 120 224 115
Ratio Youth/School
1960 366 1,050 357
1970 344 1,006 2,265 462
1980 384 1,104 1,990 2,364 449 204
1990 424 919 1,721 2,222 384 709 206 292
2000 565 778 1,840 1,809 401 746 217 379
2010 970 777 1,363 1,362 388 681 245 389 260
2020 1,582 802 1,062 1,126 426 751 264 411 280
Ratio Student/Teacher
1960 35 35 24 33
1970 29 26 57 24 25
1980 27 25 48 32 15 21 17
1990 22 21 36 29 13 19 14
2000 22 18 29 19 12 16 17 12 13
2010 18 17 19 15 10 12 18 9 10
2020 17 15 14 12 9 12 17 11 10
Ratio Youth/Teacher
1960 99 78 73 75
1970 92 68 134 74 65
1980 64 59 108 83 56 42 51
1990 58 51 80 67 44 71 38 39
2000 53 46 69 46 40 60 36 22 34
2010 44 41 45 36 38 49 38 16 27
2020 39 37 34 31 34 49 37 20 24
Elasticity Δ\Delta%Student/Δ\Delta%School
2020 vs 1960 -0.18 1.83 1.04
2020 vs 1970 -0.02 1.58 -19.93 1.73
2020 vs 1980 0.32 2.15 9.26 -5.68 1.06 0.44
2020 vs 1990 0.16 1.53 13.16 -8.66 0.60 0.29 0.09
2020 vs 2000 0.25 0.76 -2.04 -32.75 1.14 1.44 0.01 0.65
2020 vs 2010 -0.20 0.88 -4.04 20.19 -1.22 -0.03 0.27 0.85 11.78
Elasticity Δ\Delta%Youth/Δ\Delta%School
2020 vs 1960 0.08 1.63 0.57
2020 vs 1970 0.29 1.75 -19.44 1.24
2020 vs 1980 0.35 1.99 8.77 -5.78 1.35 0.15
2020 vs 1990 0.29 1.47 11.90 -8.01 0.10 0.64 -0.08 -0.02
2020 vs 2000 0.28 0.87 -2.03 -31.02 0.45 0.94 -0.22 0.49
2020 vs 2010 0.00 0.75 -4.07 16.17 -0.89 -0.89 0.13 0.54 5.26
Elasticity Δ\Delta%Student/Δ\Delta%Teacher
2020 vs 1960 0.10 -2.91 -0.44 -0.03
2020 vs 1970 0.02 -2.27 -0.61 -0.83 0.00
2020 vs 1980 -1.57 4.82 -0.89 -1.18 -0.38 -1.13 0.17
2020 vs 1990 -0.81 6.72 -1.16 -2.88 -0.24 -1.67 0.36
2020 vs 2000 -1.79 -3.94 -0.94 8.60 -1.15 -1.47 -0.22 -2.17 0.24
2020 vs 2010 0.54 -14.97 -2.59 8.73 0.42 0.04 -1.40 0.38 0.89
Elasticity Δ\Delta%Youth/Δ\Delta%Teacher
2020 vs 1960 -0.04 -2.59 -0.24 -0.01
2020 vs 1970 -0.31 -2.50 -0.59 -0.60 -0.03
2020 vs 1980 -1.71 4.45 -0.84 -1.20 -0.48 -0.38 0.01
2020 vs 1990 -1.51 6.42 -1.05 -2.66 -0.04 -0.29 0.48 0.12
2020 vs 2000 -2.06 -4.49 -0.93 8.14 -0.46 -0.96 3.21 -1.62 0.06
2020 vs 2010 0.01 -12.71 -2.61 6.99 0.31 1.12 -0.66 0.24 0.40