Example Report Assets Section

# Hide all of the extra messages and code in the final report:
#
#   knitr::opts_chunk$set( echo=F, message=F, warning=F )
#

library( dplyr )
library( pander )
library( knitr )
library( gender )



# SOURCE CUSTOM FUNCTIONS
source( "utils.R" )


# LOAD DATA
URL <- params$url
d <- read.csv( URL )


# DATA STEPS 

d$first.name <- get_first_name( d$Full.Name )
d <- add_gender( d )
d <- add_titles( d )
d <- fix_salary( d )

d <-      # report sample
  d %>% 
  filter( title != "" & ! is.na(title) ) %>% 
  filter( Department.Description %in% academic.units )



Salary Range by Rank and Gender

# {r, results="asis", fig.height=7, fig.width=10}

t.salary <- 
  d %>% 
  group_by( title, gender ) %>% 
  summarize( q25=quantile(salary,0.25),
             q50=quantile(salary,0.50),
             q75=quantile(salary,0.75),
             n=n() ) %>% 
  ungroup() %>% 
  mutate( p= round( n/sum(n), 2) )

t.salary %>% build_graph( unit="ALL ASU")

NULL

t.salary$q25 <- dollarize( t.salary$q25 )
t.salary$q50 <- dollarize( t.salary$q50 )
t.salary$q75 <- dollarize( t.salary$q75 )

t.salary %>% knitr::kable(format="html")
title gender q25 q50 q75 n p
Full Professor male $115,127 $137,453 $174,436 335 0.15
Full Professor female $106,445 $128,150 $155,296 128 0.06
Full Professor uncoded $131,456 $150,000 $178,500 49 0.02
Associate Professor male $ 90,902 $102,173 $118,450 212 0.09
Associate Professor female $ 86,606 $ 95,149 $110,108 166 0.07
Associate Professor uncoded $ 99,034 $108,669 $119,008 58 0.03
Assistant Professor male $ 85,000 $ 92,800 $100,500 137 0.06
Assistant Professor female $ 80,600 $ 87,200 $ 94,875 134 0.06
Assistant Professor uncoded $ 86,000 $ 94,900 $100,000 55 0.02
Teaching Faculty male $ 49,000 $ 57,925 $ 89,800 273 0.12
Teaching Faculty female $ 47,406 $ 52,500 $ 67,350 336 0.15
Teaching Faculty uncoded $ 47,410 $ 57,000 $ 88,397 47 0.02
Researcher male $ 50,000 $ 55,330 $ 70,488 152 0.07
Researcher female $ 48,922 $ 54,468 $ 67,224 126 0.06
Researcher uncoded $ 48,000 $ 51,075 $ 59,945 72 0.03