Skip to content

Commit 6db7207

Browse files
Merge pull request #79 from HughParsonage/RM-RcppParallel
Rm rcpp parallel
2 parents 41c4e99 + 59f3073 commit 6db7207

20 files changed

+219
-141
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ r_github_packages:
2424
after_success:
2525
- Rscript -e 'formalCoverage::formalPackageCoverage()'
2626
- Rscript -e 'library(taxstats);library(data.table);print(sample_file_1415_synth)'
27-
- Rscript -e 'library(taxstats);library(data.table);print(setDT(sample_file_0304))'
2827
- Rscript -e 'remove.packages("taxstats")'
2928
- Rscript -e 'install.packages(c("devtools", "roxygen2"))'
3029
- Rscript -e 'devtools::test()'

DESCRIPTION

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: grattan
22
Type: Package
33
Title: Australian Tax Policy Analysis
4-
Version: 1.5.3.6
5-
Date: 2018-02-21
4+
Version: 1.5.3.7
5+
Date: 2018-02-22
66
Authors@R: c(person("Hugh", "Parsonage", role = c("aut", "cre"), email = "hugh.parsonage@gmail.com"),
77
person("Tim", "Cameron", role = "aut"),
88
person("Brendan", "Coates", role = "aut"),
@@ -29,12 +29,10 @@ Imports:
2929
assertthat,
3030
magrittr,
3131
Rcpp (>= 0.12.3),
32-
RcppParallel,
3332
utils,
3433
zoo
3534
LinkingTo:
36-
Rcpp,
37-
RcppParallel
35+
Rcpp
3836
RoxygenNote: 6.0.1
3937
Suggests:
4038
dplyr,
@@ -54,4 +52,3 @@ Suggests:
5452
Additional_repositories: https://hughparsonage.github.io/drat/
5553
LazyData: true
5654
VignetteBuilder: knitr
57-
SystemRequirements: GNU make

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export(weighted_ntile)
6060
export(yr2fy)
6161
import(data.table)
6262
importFrom(Rcpp,sourceCpp)
63-
importFrom(RcppParallel,RcppParallelLibs)
6463
importFrom(fastmatch,"%fin%")
6564
importFrom(hutils,AND)
6665
importFrom(hutils,NEITHER)

R/RcppExports.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pmax3 <- function(x, y, z) {
6969
#' @name pmaxC
7070
#' @param x A numeric vector.
7171
#' @param a A single numeric value.
72-
#' @return The parallel maximum of the input values.
72+
#' @return The parallel maximum of the input values. \code{pmax0(x)} is shorthand for \code{pmaxC(x, 0)}, i.e. convert negative values in \code{x} to 0.
7373
#' @note This function will always be faster than \code{pmax(x, a)} when \code{a} is a single value, but can be slower than \code{pmax.int(x, a)} when \code{x} is short. Use this function when comparing a numeric vector with a single value.
7474
#' @export pmaxC
7575
NULL
@@ -78,6 +78,10 @@ pmaxC <- function(x, a) {
7878
.Call(`_grattan_pmaxC`, x, a)
7979
}
8080

81+
pmax0 <- function(x) {
82+
.Call(`_grattan_pmax0`, x)
83+
}
84+
8185
#' @title Parallel maximum
8286
#' @description A faster \code{pmax()}.
8387
#'
@@ -98,7 +102,7 @@ pmaxV <- function(x, y) {
98102
#' @name pminC
99103
#' @param x A numeric vector.
100104
#' @param a A single numeric value.
101-
#' @return The parallel minimum of the input values.
105+
#' @return The parallel minimum of the input values. The \code{0} versions are shortcuts for \code{a = 0}.
102106
#' @note This function will always be faster than \code{pmin(x, a)} when \code{a} is a single value, but can be slower than \code{pmin.int(x, a)} when \code{x} is short. Use this function when comparing a numeric vector with a single value.
103107
#' @export pminC
104108
NULL
@@ -107,6 +111,10 @@ pminC <- function(x, a) {
107111
.Call(`_grattan_pminC`, x, a)
108112
}
109113

114+
pmin0 <- function(x) {
115+
.Call(`_grattan_pmin0`, x)
116+
}
117+
110118
#' @title Parallel maximum
111119
#' @description A faster \code{pmin()}.
112120
#'

R/grattan-package.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#' @importFrom magrittr and
2626

2727
#' @importFrom Rcpp sourceCpp
28-
#' @importFrom RcppParallel RcppParallelLibs
2928
#' @importFrom stats complete.cases
3029
#'
3130
#'

R/income_tax.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ income_tax_cpp <- function(income, fy.year, .dots.ATO = NULL, sapto.eligible = N
501501
.[, "lito" := lito.] %>%
502502
.[, "sapto" := sapto.] %>%
503503
.[, "medicare_levy" := medicare_levy.] %>%
504-
.[, "income_tax" := out]
504+
.[, "income_tax" := out] %>%
505+
.[, "SBTO" := sbto.]
505506

506507
# if (fy.year == "2011-12") {
507508
# result[, "flood_levy" := flood_levy.]

R/small_business_tax_offset.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ small_business_tax_offset <- function(taxable_income,
135135
}
136136
smbto_p <- tax_discount
137137
}
138-
139-
out <- pminC(prop_tax_for_biz * smbto_p, 1000)
138+
out <- prop_tax_for_biz * smbto_p
139+
out[is.nan(out)] <- 0
140+
out <- pminC(out, 1000)
140141

141142
# Only business with an aggregate annual turnover of less than $2M
142143
out[aggregated_turnover >= 2e6] <- 0

cran-comments.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
0 ERRORS | 0 WARNINGS | 1-3 NOTEs
33

44
### Test environments:
5-
* Local Windows R 3.4.3
5+
* Local Windows MRAN 3.4.3:
6+
- taxstats 0.0.4.1314
7+
- taxstats 0.0.5.1415
68
* Travis-CI: R 3.3, 3.4, and dev
7-
* Appveyor: dev and release.
9+
* Appveyor: dev (ERROR as data.table was unavailable) and release.
810
* winbuilder: dev and release.
911

10-
This is an update to skip tests that do not run reliably on CRAN, following updates to dependencies. There was a single new NOTE indicating that the last submission was not long ago: this update was requested by CRAN.
12+
This is an update and resubmission to skip tests that do not run reliably on CRAN, following updates to dependencies. There was a single new NOTE indicating that the last submission was not long ago: this update was requested by CRAN. In addition, the UBSAN issues have been avoided by removing the dependency on RcppParallel entirely.
1113

1214
NOTES:
13-
'Days since last update: 3'
15+
'Days since last update: 4'
1416
==> Update requested by CRAN.
1517

1618
Possibly mis-spelled words in DESCRIPTION: ...
@@ -19,9 +21,6 @@ Possibly mis-spelled words in DESCRIPTION: ...
1921
Suggests or Enhances not in mainstream repositories: ...
2022
==> Normal due to taxstats dependency
2123

22-
GNU make is a SystemRequirements.
23-
==> Required.
24-
2524
## Note to CRAN: moderately-large vignette
2625
The vignette is quite lengthy and, while it will run on CRAN, requires the installation of 'taxstats', a 58 MB source package, each time the package is checked.
2726

man/pmaxC.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/pminC.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)