Skip to content

Commit

Permalink
Provisional commit for project_
Browse files Browse the repository at this point in the history
  • Loading branch information
HughParsonage committed Mar 27, 2024
1 parent 01e47b2 commit 9d04aa7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
18 changes: 14 additions & 4 deletions R/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ project <- function(sample_file,
.copyDT = TRUE,
check_fy_sample_file = TRUE,
differentially_uprate_Sw = NA,
r_super_balance = 1.05) {
r_super_balance = 1.05,
r_generic = 1) {
if (length(h) != 1L) {
stop("`h` had length-", length(h), ", ",
"but must be a length-1 positive integer.")
Expand Down Expand Up @@ -138,15 +139,15 @@ project <- function(sample_file,
# without updating the fy.year.of.sample.file
if (is.null(fy.year.of.sample.file)) {
fy.year.of.sample.file <-
match(nrow(sample_file), c(254318L, 258774L, 263339L, 269639L, 277202L, 284925L))
match(nrow(sample_file), c(254318L, 258774L, 263339L, 269639L, 277202L, 284925L, 301687L))
if (is.na(fy.year.of.sample.file)) {
stop("`fy.year.of.sample.file` was not provided, and its value could not be ",
"inferred from nrow(sample_file) = ", nrow(sample_file), ". Either use ",
"a 2% sample file of the years 2012-13, 2013-14, or 2014-15 or ",
"supply `fy.year.of.sample.file` manually.")
}
fy.year.of.sample.file <-
c("2012-13", "2013-14", "2014-15", "2015-16", "2016-17", "2017-18")[fy.year.of.sample.file]
c("2012-13", "2013-14", "2014-15", "2015-16", "2016-17", "2017-18", "2020-21")[fy.year.of.sample.file]
}


Expand Down Expand Up @@ -181,6 +182,11 @@ project <- function(sample_file,
warning("nrow(sample_file) != 284925. Should you choose a different fy.year.of.sample.file?")
}
},
"2020-21" = {
if (nrow(sample_file) != 301687) {
warning("nrow(sample_file) != 301687 Should you choose a different fy.year.of.sample.file?")
}
},
stop("`fy.year.of.sample.file` must be '2012-13', '2013-14', '2014-15', '2015-16', '2016-17',
or '2017-18'."))
}
Expand Down Expand Up @@ -454,7 +460,11 @@ project <- function(sample_file,
},
"generic" = {
if (.recalculate.inflators) {
generic.inflators[variable == j]$inflator * v
if (nrow(generic.inflators)) {
generic.inflators[variable == j]$inflator * v
} else {
v
}
} else {
generic.inflators[.(H, j), inflator] * v
}
Expand Down
7 changes: 7 additions & 0 deletions data-raw/put-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,13 @@ Age_pension_deeming_rates_by_Date <-
.[, type := gsub("_", " ", gsub("threshold_", "", type, fixed = TRUE))] %>%
.[, .(Date, type, threshold, deeming_rate_below, deeming_rate_above)]

aus_delta <-
abs31[series_id %chin% c("A2133244X", "A2133245A", "A2133252X", "A2133246C", "A2133247F", "A2133248J")] %>%
drop_constant_cols %>%
.[, title := gsub(" ", "", trim_common_affixes(series))] %>%
.[]
.[, .(date, )]

aus_pop <- readabs::read_abs("3101.0", table = 59)
# aus_pop_all <- readabs::read_abs("3101.0", check_local = FALSE)

Expand Down
2 changes: 1 addition & 1 deletion man/apply_super_caps_and_div293.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/inverse_average_rate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/model_new_caps_and_div293.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/project.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d04aa7

Please sign in to comment.