-
-
Save katerabinowitz/07e53e52a2c670ce30d224800b3118a3 to your computer and use it in GitHub Desktop.
AECF Connecting Data Systems, Data Loading
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
library("dplyr") | |
options(stringsAsFactors=FALSE) | |
bhs <- read.csv("Behavioral Health Services.csv") %>% | |
mutate( | |
SVC_START_DT = as.Date(SVC_START_DT, "%m/%d/%Y"), | |
SVC_END_DT = as.Date(SVC_END_DT, "%m/%d/%Y"), | |
SUBMT_DT = as.Date(SUBMT_DT, "%m/%d/%Y") | |
) | |
cyf <- read.csv("CYF Active 2010 to 2016-11-09(1).csv") %>% | |
mutate( | |
BRTH_DT = as.Date(BRTH_DT, "%m/%d/%Y"), | |
INVLV_STRT_DT = as.Date(INVLV_STRT_DT, "%m/%d/%Y"), | |
INVLV_END_DT = as.Date(INVLV_END_DT, "%m/%d/%Y"), | |
RACE_black = grepl("Black or African American", RACE), | |
RACE_white = grepl("White", RACE), | |
RACE_asian = grepl("Asian(?! Indian)", RACE, perl = TRUE), | |
RACE_ai = grepl("American Indian or Alaska Native", RACE), | |
RACE_pi = grepl("Native Hawaiian or Other Pacific Islander", RACE), | |
RACE_other = grepl("Other Race", RACE), | |
RACE_filipino = grepl("Filipino", RACE), | |
RACE_chinese = grepl("Chinese", RACE), | |
RACE_japanese = grepl("Japanese", RACE), | |
RACE_korean = grepl("Korean", RACE), | |
RACE_guamanian = grepl("Guamanian or Charmorro", RACE), | |
RACE_aindian = grepl("Asian Indian", RACE), | |
RACE_otherasian = grepl("Other Asian", RACE), | |
RACE_otherpi = grepl("(?<!Native Hawaiian or )Other Pacific Islander", RACE, perl = TRUE), | |
RACE_declined = grepl("Declined to Answer", RACE), | |
RACE_undetermined = grepl("Unable to Determine", RACE), | |
RACE_noask = grepl("Did Not Ask", RACE) | |
) | |
shelters <- read.csv("HomelessShelters(1).csv") %>% | |
mutate( | |
PROJ_INVOLVEMENT_EPISODE_START = as.Date(PROJ_INVOLVEMENT_EPISODE_START, "%m/%d/%Y"), | |
PROJ_INVOLVEMENT_EPISODE_END = as.Date(PROJ_INVOLVEMENT_EPISODE_END, "%m/%d/%Y") | |
) | |
rp_abscondence <- read.csv("rp_abscondence_clean.csv") %>% | |
mutate( | |
Abscondence.Date = as.Date(Abscondence.Date, "%Y-%m-%d"), | |
Return.Date = as.Date(Return.Date, "%Y-%m-%d") | |
) | |
rp_placements <- read.csv("rp_placements_clean.csv") %>% | |
mutate( | |
RMVL_DATE = as.Date(RMVL_DATE, "%Y-%m-%d"), | |
RTRN_DATE = as.Date(RTRN_DATE, "%Y-%m-%d"), | |
ANALYSIS_ENTRY_DT = as.Date(ANALYSIS_ENTRY_DT, "%Y-%m-%d"), | |
ANALYSIS_EXIT_DT = as.Date(ANALYSIS_EXIT_DT, "%Y-%m-%d") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment