library(data.table)
library(SampleFile1516)
library(SampleFile1415)
library(grattan)
library(hutils)
library(magrittr)
library(ggplot2)
library(grattanCharts)
## 
## Attaching package: 'grattanCharts'
## The following object is masked from 'package:datasets':
## 
##     Orange
library(scales)
# Percent women:
s1415[, .(isAffected = mean(isAffected)), keyby = "Sex"]
##       Sex isAffected
## 1: Female 0.08014375
## 2:   Male 0.05970204
s1516[, .(isAffected = mean(isAffected)), keyby = "Sex"]
##       Sex isAffected
## 1: Female 0.08082132
## 2:   Male 0.05997154
## [1] 0.5582023
## [1] 0.6792155
# Average sizes by gender
s1516[, .(avgAffected = mean(Dividends_franking_cr_amt)), keyby = "Gender"]
##    Gender avgAffected
## 1:      0    718.6282
## 2:      1    632.0685
s1516[Dividends_franking_cr_amt > 0, .(avgAffected = mean(Dividends_franking_cr_amt)), keyby = "Gender"]
##    Gender avgAffected
## 1:      0    3447.503
## 2:      1    2888.947
##    Gender avgAffected
## 1:      0    2636.391
## 2:      1    2306.922
##       Sex avgDelta
## 1: Female 186.4485
## 2:   Male 158.1084
##       Sex avgDelta
## 1: Female 2306.922
## 2:   Male 2636.391