Skip to content

Commit

Permalink
v1.1.2 - amended Life expectancy and proportion test scripts to resol…
Browse files Browse the repository at this point in the history
…ve test execution in non-windows environments as requested by CRAN.
  • Loading branch information
PHEgeorginaanderson committed Apr 23, 2019
1 parent 4af2e4e commit f303a36
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,6 +1,6 @@
Package: PHEindicatormethods
Type: Package
Version: 1.1.1
Version: 1.1.2
Title: Common Public Health Statistics and their Confidence Intervals
Description: Functions to calculate commonly used public health statistics and
their confidence intervals using methods approved for use in the production
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,3 +1,8 @@
## PHEindicatormethods v1.1.2

Minor amendments to package testing scripts. Updates will not affect end users.


## PHEindicatormethods v1.1.1

The following changes may affect backwards compatibility with earlier versions of the package:
Expand Down
18 changes: 7 additions & 11 deletions cran-comments.md
@@ -1,18 +1,14 @@

## Resubmission of updated package version 1.1.1
In this resubmission I have replaced spaces with %20s in a URL referenced in phe_life_expectancy.Rd
## Resubmission of updated package version 1.1.2
Following recent release of package v1.1.1 to CRAN on 18/04/2019, I then received notification that
some tests were failing with nonsensical error messages on r-devel-linux-x86_64-fedora-clang and
r-devel-linux-x86_64-debian-clang and r-oldrel-windows-ix86+x86_64. See <https://cran.r-project.org/web/checks/check_results_PHEindicatormethods.html>

In this resubmission I have re-coded the affected tests in testProportions.R and testLifeExpectancy.R to resolve these issues although I have been unable to retest on the affected operating system environemnts.

This package release v1.1.1 will replace the previous release v1.0.8 currently available on CRAN
This package release v1.1.2 will replace the previous release v1.1.1 currently available on CRAN

## Amendments in v1.1.1
3 new functions have been added:

* phe_quantiles
* phe_life_expectancy
* phe_sii

Also, minor amendments to existing functions. These may result in backwards incompatibility - the circumstances when this may occur are clearly stated in the NEWS.md file and in the function documentation with solutions for how to make old code compatible with the later package version (eg logical 'percentage' argument replaced with numeric 'multiplier' argument - percentage = TRUE equivalent to multiplier = 100 etc).
No changes have been made to the function code or documentation but I have incremented the version number and news file.

## Test Environments
* local windows 10 install: R 3.5.1 and R 3.5.3 - Both OK
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/testLifeExpectancy.R
Expand Up @@ -251,17 +251,17 @@ test_that("LE - errors are generated when invalid arguments are used",{
expect_error(phe_life_expectancy(df3, deaths, pops, startage),
"the contents in the startage field do not match the contents of the age_contents vector")
expect_error(phe_life_expectancy(df3, deaths, pops, startage,
age_contents = c("0", "1-4", "5-9",
"20 24", "25 29",
"10 14", "15 19",
"30 34", "35 39",
"40 44", "45 49",
"50 54", "55 59",
"60 64", "65 69",
"70 74", "75 79",
"80 84", "85 89",
"90 +")),
"age_contents doesn't appear to be in ascending order; the following age bands appear out of position: 20 24, 25 29, 10 14, 15 19")
age_contents = c("0", "1 4", "5 9",
"20 24", "25 29",
"10 14", "15 19",
"30 34", "35 39",
"40 44", "45 49",
"50 54", "55 59",
"60 64", "65 69",
"70 74", "75 79",
"80 84", "85 89",
"90+")),
"age_contents doesn't appear to be in ascending order; the following age bands appear out of position: 20 24, 25 29, 10 14, 15 19")
expect_error(phe_life_expectancy(),
"function life_expectancy requires at least 4 arguments: data, deaths, population, startage")
expect_error(phe_life_expectancy(df1, deaths, pop, age,
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/testProportions.R
Expand Up @@ -28,8 +28,8 @@ test_that("proportions and CIs calculate correctly",{
expect_equal(phe_proportion(slice(test_Prop,1:8)[1:3], Numerator, Denominator, type="upper"),
select(slice(test_Prop,1:8),1:3,6),check.attributes=FALSE, check.names=FALSE, info="test upper")

expect_equal(phe_proportion(slice(test_Prop,33:35)[1:3], Numerator, Denominator, type="full"),
select(slice(test_Prop,33:35),1:9),check.attributes=FALSE, check.names=FALSE, info="test NAs")
expect_equal(phe_proportion(filter(test_Prop,Area %in% c("Area9","Area10","Area11"))[1:3], Numerator, Denominator, type="full"),
select(filter(test_Prop,Area %in% c("Area9","Area10","Area11")),1:9),check.attributes=FALSE, check.names=FALSE, info="test NAs")

expect_equal(data.frame(phe_proportion(slice(test_Prop_g,1:8)[1:3], Numerator, Denominator, type="standard")),
arrange(data.frame(test_Prop_g_results[1:6]),Area),check.attributes=FALSE, check.names=FALSE, info="test grouped")
Expand Down

0 comments on commit f303a36

Please sign in to comment.