Last active
January 5, 2016 16:29
-
-
Save dfeng/c52b72f3f217d802f270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------- | |
# | Masters Application Script | | |
# \ __________________________ / | |
# \ ^__^ | |
# \ (oo)\_______ | |
# (__)\ )\/\ | |
# ||----w | | |
# || || | |
# Here's my folder structure: | |
# | |
# Masters Application/ | |
# Pass1.csv | |
# this_script.R | |
# Names_01_03/ | |
# bla_bla_1.pdf | |
# ... | |
# | |
# Set the WD to the containing folder, in my case `Masters Application` | |
setwd("/Users/dfeng/Documents/Work/Current/Masters Application") | |
library(dplyr) # DON'T TELL JAY! | |
# ========================== # | |
# === GLOBAL VARIABLES === # | |
# ========================== # | |
USER <- "Derek" # Your Name | |
FOLDER <- "Names_01_03" # Folder with pdfs | |
FILE <- "Pass1.csv" # Filename for csv | |
# ===================== # | |
# === Reading CSV === # | |
# ===================== # | |
x <- read.csv(FILE) | |
x <- x %>% | |
filter(pass1 == USER) # x now contains only you | |
# ====================== # | |
# === Moving Files === # | |
# ====================== # | |
# To make things easier, we create a new folder called | |
# $USER (`Derek` in my case), and copy your responsibilites | |
# to that folder (prepending the row number to the file name) | |
dir.create(USER) | |
files <- x %>% | |
mutate(name = paste(Applicant.Last.Name, | |
gsub(" ","",Applicant.First.Name), | |
Applicant.Client.ID, sep="_") | |
) %>% | |
select(name) | |
for (i in 1:nrow(files)) { | |
file.copy( | |
paste0(FOLDER, "/", files[i,], ".pdf"), | |
paste0(USER, "/",i,"_", files[i,], ".pdf") | |
) | |
} | |
# ========================== # | |
# === Helper Functions === # | |
# ========================== # | |
Add <- function(x, i, score, comment) { | |
x$SCORE_0_10[i] <- score | |
x$COMMENT[i] <- comment | |
x | |
} | |
# TODO | |
Summarize <- function(x, i) { | |
person <- x[i,] | |
udate1 <- strptime(x$Prior.University.1.Attend.Date, "%m/%d/%y", tz="EST") | |
udate2 <- strptime(x$Prior.University.2.Attend.Date, "%m/%d/%y", tz="EST") | |
max.date <- pmax(udate1, udate2, na.rm=TRUE) | |
} | |
# ==================================== # | |
# === Adding Stuff to the Matrix === # | |
# ==================================== # | |
x <- x %>% | |
Add(57, 8, "From industry. Lots of experience.") %>% | |
Add(33, 0, "Poor recommendations. Nothing spectacular.") %>% | |
Add(43, 5, "FINANCE. WHY?") %>% | |
Add(44, 8, "Good grades. Top in class?") %>% | |
Add(53, 1, "TOEFL = 100. Not particularly good grades.") %>% | |
Add(1, 4, "Nothing really special") %>% | |
Add(2, 1, "Ummm...Interesting backstory, but really not strong background, and it seems like the masters is really just for one project.") %>% | |
Add(3, 0, "Wow this guy is really into MOOCs. It says he's applying for the MA, but his reference says Ph.D. Probably because he already did on at Columbia...What the point??") %>% | |
Add(4, , "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment