inst/data-raw/schools.R

library(dplyr)
library(readr)

school_names <- c(
  "American School of Bombay",
  "Cairo American School",
  "Frankfurt International School",
  "Graded School at Sao Paulo",
  "Singapore American School",
  "Zurich International School",
  "American Community School of Abu Dhabi",
  "American Community School of Amman",
  "American International School of Budapest",
  "American International School of Chennai",
  "Avenues: The World School",
  "French American International School",
  "Lakefield College School",
  "United Nations School of Hanoi",
  "American Embassy School, New Delhi",
  "Knox Grammar School",
  "Qatar Academy of Doha",
  "Robert College of Istanbul",
  "Academia Cotopaxi",
  "United Nations School of NY",
  "International School Manila",
  "Nexus International School - Putrajaya",
  "Cary Academy",
  "Vienna International School",
  "International School of Düsseldorf",
  "American School of Dubai",
  "International School Basel",
  "British School Jakarta",
  "Institut International de Lancy",
  "The KAUST School",
  "Stamford American International School",
  "HELP International School")

school_short_names <- c(
  "ASB",
  "CAC",
  "FIS",
  "Graded",
  "SAS",
  "ZIS",
  "ACS Abu Dhabi",
  "ACS Amman",
  "AIS Budapest",
  "AIS Chennai",
  "Avenues",
  "FAIS",
  "Lakefield",
  "UNIS Hanoi",
  "AES New Delhi",
  "Knox",
  "Qatar",
  "Robert College",
  "Academia Cotopaxi",
  "UNIS NY",
  "IS Manila",
  "Nexus",
  "Cary",
  "VIS",
  "ISD",
  "ASD",
  "ISB",
  "BSJ",
  "IIL",
  "KAUST",
  "SAIS",
  "HIS")

school_idx <- c(1:27, 91, 110, 80, 30, 130)

schools <- data_frame(school = school_names,
                      school_short = school_short_names,
                      idx = school_idx) %>%
  arrange(school)

devtools::use_data(schools, overwrite = T)

### Join student enrollment and teacher employment data ###

data_dir <- system.file(package = "irc", "data-raw")

student_enrollment <- read_csv(
  file.path(data_dir, "student_enrollment.csv"),
  col_types =
    list(
      school = col_character(),
      enrollment = col_integer(),
      year = col_integer()
    )
)

teacher_employment <- read_csv(
  file.path(data_dir, "teacher_employment.csv"),
  col_types =
    list(
      school = col_character(),
      n_teachers = col_integer(),
      year = col_integer()
    )
)

school_survey <- left_join(student_enrollment, teacher_employment,
                     by = c("school", "year")) %>%
  select(school, year, enrollment, n_teachers)

devtools::use_data(school_survey, overwrite = TRUE)
ircollaborative/report documentation built on July 28, 2018, 7:33 p.m.