-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
96 lines (96 loc) · 3.27 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
shinylive::export(appdir = "app", destdir = "docs")
httpuv::runStaticServer("docs")
shiny::runApp('app')
rep(1:2, 5)
x = data.table(rep(c(1, 2), 5), rep(1:2, 5))
x = data.table("id" = rep(c(1, 2), 5), "value" = rep(1:2, 5))
x[, mean]
x[, mean(value), by = id]
x[, mean(value) + value, by = id]
x = data.table("id" = rep(c(1, 2), 5),
"value" = c(0, 2, 0, 2, 0, 2, 2, 2, 2, 2))
x[, mean(value) + value, by = id]
x = data.table("id" = rep(c(1, 2), 5),
"value" = c(1, 2, 0, 2, 0, 2, 2, 2, 2, 2))
x[, mean(value) + value, by = id]
x = data.table("id" = rep(c(1, 2), 5),
"value" = c(1, 2, 0, 2, 0, 2, 2, 2, 2, 2))
x[, mean(value) + value*0, by = id]
x
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 2, 0, 2, 2, 2))
x
x[, mean(value) + value, by = id]
x[, value, by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 2, 0, 2, 2, 2))
x[, value, by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 0, 2, 2, 2, 2))
x[, value, by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 0, 2, 2, 2, 2))
x
x[, value, by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 0, 2, 2, 2, 2))
x[, mean(value), by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(1, 0, 2, 2, 2, 2))
x
x[, mean(value), by = id]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(2, 2, 2, 2, 2, 2))
x
x[, mean(value), by = id]
x[, mean(value), by = .(id)]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(2, 2, 2, 2, 2, 2))
x
x[, mean(value), by = .(id)]
x = data.table("id" = rep(1:2, 3, each = T), "value" = c(2, 1, 2, 2, 2, 2))
x
x[, mean(value), by = .(id)]
?rep
x = data.table("id" = rep(1:2, each = 3), "value" = c(2, 1, 0, 2, 2, 2))
x
x[, mean(value) + value, by = .(id)]
x = data.table("id" = rep(1:2, each = 3), "value" = c(2, 1, 0, 2, 2, 2))
x[, value + 5, by = .(id)]
ls
ls
source("~/.active-rstudio-document", echo=TRUE)
View(x)
x = fread("IncomeExplorer_TY24_HYEFU23.csv")
View(x)
dput(x)
runApp('app')
runApp('app')
source("C:/LiamB/TSY EMTR Tool/app/R/hard_load.R", echo=TRUE)
source("C:/LiamB/TSY EMTR Tool/app/R/hard_load.R", echo=TRUE)
source("C:/LiamB/TSY EMTR Tool/app/R/hard_load.R", echo=TRUE)
source("C:/LiamB/TSY EMTR Tool/app/R/hard_load.R", echo=TRUE)
knitr::opts_chunk$set(echo = TRUE)
## LOADING LIBRARIES
library(data.table)
library(ggplot2)
### LOADING DATA
data = fread("HES18_TY24_EMTR.csv")
### DATA SEGMENTATION
data = data[EMTR > 0 & EMTR < 1.1]
data = data[Fam_Super == FALSE]
## Single
single_data = data[Fam_Type == "Single"]
## Couple
# Primary
couple_data = data[Fam_Type == "Couple" & Earner == "EMTR_Main"]
# Secondary
couple_secondary_data = data[Fam_Type == "Couple" & Earner == "EMTR_Secondary"]
## Single with Children
single_parent_data = data[Fam_Type == "Single with children"]
## Couple with Children
# Primary
couple_parent_data = data[Fam_Type == "Couple with children" & Earner == "EMTR_Main"]
# Secondary
couple_parent_secondary_data = data[Fam_Type == "Couple with children" & Earner == "EMTR_Secondary"]
# Proportion with EMTR greater than
marginal_tax_rates = c(0.105, 0.175, 0.3, 0.33, 0.39)
acc_levy = 0.016
proporation_abating = data[, sum(EMTR > marginal_tax_rates[TaxBand] + acc_levy) / .N,
by = .(Fam_Type)]
proporation_abating
knitr::opts_chunk$set(echo = TRUE)
values = read.xlsx("idi_output.xlsx", sheet = "Values")
pwd