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 $118,848 $141,274 $175,000 338 0.14
Full Professor female $110,700 $129,943 $160,387 141 0.06
Full Professor uncoded $132,146 $154,223 $188,112 56 0.02
Associate Professor male $ 95,000 $105,890 $122,268 229 0.09
Associate Professor female $ 89,830 $ 98,846 $112,949 180 0.07
Associate Professor uncoded $101,200 $111,022 $121,064 52 0.02
Assistant Professor male $ 83,314 $ 94,400 $101,950 147 0.06
Assistant Professor female $ 82,000 $ 87,107 $ 94,300 141 0.06
Assistant Professor uncoded $ 86,775 $ 96,500 $100,500 66 0.03
Teaching Faculty male $ 49,000 $ 57,500 $ 86,468 319 0.13
Teaching Faculty female $ 48,600 $ 54,000 $ 67,961 378 0.15
Teaching Faculty uncoded $ 48,980 $ 55,000 $ 86,791 57 0.02
Researcher male $ 50,123 $ 59,483 $ 71,952 169 0.07
Researcher female $ 50,444 $ 55,699 $ 68,216 114 0.05
Researcher uncoded $ 49,007 $ 52,772 $ 60,869 72 0.03