R/Pull_Outcomes.R

Defines functions PullOutcomes

PullOutcomes<-function(Metric,Year){
  library(tidyverse)

  dat<-read.csv('C:\\Users\\lance.sisco\\Documents\\R\\R\\R-3.3.1\\etc\\SourceData.csv')

  datasources<-dat %>%
    filter(School.Year==Year)

  if(nrow(datasources)==0){print(paste(Year," not found in source Data.  Please use ",
                                       paste(dat %>% select(School.Year) %>% distinct(),collapse=','),
                                       sep=''))}


  datasources<-datasources %>%
    filter(Measure==Metric)

  if(nrow(datasources)==0){print(paste(Metric," not found in source Data in the specific year.  Please use ",
                                       paste(dat %>% select(Measure) %>% distinct(),collapse=','),
                                       sep=''))}


  location<-datasources %>%
    select(Table.or.File.Location)

  if(Metric=='Grad'){
    dat<-GradRateStudentLevel(location$Table.or.File.Location)

  }

  if(Metric=='Proficiency'){
    dat<-annualAssessmentData(location$Table.or.File.Location)
  }

  if(Metric=='Growth'){
    dat<-pullSGP(location$Table.or.File.Location)
  }
  return(dat)
}
lancesiscok12/OSPICode documentation built on May 20, 2019, 1:29 p.m.