Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
achubaty committed Jun 7, 2018
2 parents 5c40658 + bc7f83a commit 4d45239
Show file tree
Hide file tree
Showing 35 changed files with 1,914 additions and 293 deletions.
9 changes: 5 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
^.*\.Rproj$
^\.Rproj\.user$
.travis.yml
cran-comments.md
^\.lintr$
^\.travis\.yml$
^appveyor\.yml$
^cran-comments\.md$
^docs$
LICENSE
^LICENSE$
^_pkgdown\.yml$
^revdep$

1 change: 1 addition & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linters: with_defaults(line_length_linter(100), object_name_linter("lowerCamelCase"), default = default_linters[-which(names(default_linters) == "object_usage_linter")])
32 changes: 15 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,44 @@ matrix:
include:
- os: linux
dist: trusty
r: 3.1.3
r: 3.1.0
cran: http://cran.rstudio.com/
before_install:
- echo "options(repos = c(CRAN='http://cran.rstudio.com'))" >> ~/.Rprofile
- os: linux
dist: trusty
r: 3.2.5
r: 3.2.0
cran: http://cran.rstudio.com/
- os: linux
dist: trusty
r: 3.3.0
cran: http://cran.rstudio.com/
- os: linux
dist: trusty
r: 3.4.0
cran: http://cran.rstudio.com/
before_install:
- echo "options(repos = c(CRAN='http://cran.rstudio.com'))" >> ~/.Rprofile
- os: linux
dist: trusty
r: oldrel
before_install:
- echo "options(repos = c(CRAN='https://cran.rstudio.com'))" >> ~/.Rprofile
- os: linux
dist: trusty
r: release
before_install:
- echo "options(repos = c(CRAN='https://cran.rstudio.com'))" >> ~/.Rprofile
r_github_packages:
- jimhester/covr
- jimhester/lintr
after_success:
- Rscript -e 'covr::coveralls(type = "all", quiet = FALSE)'
- Rscript -e 'lintr::lint_package()'
- os: linux
dist: trusty
r: devel
before_install:
- echo "options(repos = c(CRAN='https://cran.rstudio.com'))" >> ~/.Rprofile
r_packages:
- devtools
- os: osx
osx_image: xcode8
osx_image: xcode9.2
latex: false
r_build_args: '--no-build-vignettes'
r_check_args: '--as-cran --ignore-vignettes --no-examples'
before_install:
- echo "options(repos = c(CRAN='https://cran.rstudio.com'))" >> ~/.Rprofile
r_build_args: '--compact-vignettes="gs+qpdf"'
r_check_args: '--as-cran'
r_build_args: " "
r_check_args: "--as-cran"
warnings_are_errors: true
notifications:
email:
Expand Down
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Package: fpCompare
Type: Package
Title: Reliable Comparison of Floating Point Numbers
URL: https://github.com/PredictiveEcology/fpCompare
Version: 0.2.1
Date: 2015-09-01
Version: 0.2.2
Date: 2018-06-07
Authors@R: c(
person(c("Alex", "M"), "Chubaty", email="alexander.chubaty@canada.ca",
person(c("Alex", "M"), "Chubaty", email="alex.chubaty@gmail.com",
role=c("aut", "cre")),
person("Her Majesty the Queen in Right of Canada, as represented by the Minister of Natural Resources Canada",
role="cph")
Expand All @@ -15,11 +15,11 @@ Description: Comparisons of floating point numbers are problematic due to errors
Despite being aware of these problems, people still use numerical methods
that fail to account for these and other rounding errors (this pitfall is
the first to be highlighted in Circle 1 of Burns (2012)
[The R Inferno](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf)).
'The R Inferno' <http://www.burns-stat.com/pages/Tutor/R_inferno.pdf>).
This package provides new relational operators useful for performing
floating point number comparisons with a set tolerance.
Depends:
R (>= 3.1.2)
R (>= 3.1.0)
Suggests:
knitr,
rmarkdown,
Expand Down
4 changes: 4 additions & 0 deletions NEWS → NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Known issues: https://github.com/PredictiveEcology/fpCompare/issues

version 0.2.2
=============
* update maintainer's email address

version 0.2.1
=============
* update maintainer's email address
Expand Down
8 changes: 2 additions & 6 deletions R/fpCompare.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
### \code{fpCompare.tolerance} is set in \code{options} during package load
### and is unset on unload.

################################################################################
#' Relational operators with tolerance
#'
#' Binary operators which allow the comparison of values in numeric vectors.
Expand Down Expand Up @@ -66,11 +62,11 @@
#' @export
#' @rdname relational-operators
`%==%` <- function(x, y) {
(abs(x-y) < getOption("fpCompare.tolerance"))
(abs(x - y) < getOption("fpCompare.tolerance"))
}

#' @export
#' @rdname relational-operators
`%!=%` <- function(x, y) {
(abs(x-y) > getOption("fpCompare.tolerance"))
(abs(x - y) > getOption("fpCompare.tolerance"))
}
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.onLoad <- function(libname, pkgname) {
options(fpCompare.tolerance = .Machine$double.eps^0.5)
options(fpCompare.tolerance = .Machine$double.eps ^ 0.5)
}

.onUnload <- function(libname, pkgname) {
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

[![Build Status](https://travis-ci.org/PredictiveEcology/fpCompare.svg?branch=master)](https://travis-ci.org/PredictiveEcology/fpCompare)
[![Coverage Status](https://coveralls.io/repos/PredictiveEcology/fpCompare/badge.svg?branch=master)](https://coveralls.io/r/PredictiveEcology/fpCompare?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/fpCompare)](https://cran.rstudio.com/package=fpCompare)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/fpCompare)](https://cran.rstudio.com/package=fpCompare)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/fpCompare)](https://CRAN.R-project.org/package=fpCompare)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/fpCompare)](https://CRAN.R-project.org/package=fpCompare)
[![DOI](https://zenodo.org/badge/17892/PredictiveEcology/fpCompare.svg)](https://zenodo.org/badge/latestdoi/17892/PredictiveEcology/fpCompare)

## Reliable comparison of floating point numbers

Comparisons of floating point numbers are problematic due to errors associated with the binary representation of decimal numbers. Computer scientists and programmers are aware of these problems and yet people still use numerical methods which fail to account for floating point errors (this pitfall is the first to be highlighted in Circle 1 of Burns (2012) [The R Inferno](http://www.burns-stat.com/pages/Tutor/R_inferno.pdf)).
Comparisons of floating point numbers are problematic due to errors associated with the binary representation of decimal numbers. Computer scientists and programmers are aware of these problems and yet people still use numerical methods which fail to account for floating point errors (this pitfall is the first to be highlighted in Circle 1 of Burns (2012) [The R Inferno](https://www.burns-stat.com/pages/Tutor/R_inferno.pdf)).

To avoid these and other numerical rounding issues, R's help file for relational operators (*e.g.*, `?'>'`) suggests using `identical` and `all.equal` when making numerical comparisons:

Expand All @@ -19,7 +19,7 @@ x1 == x2 # FALSE on most machines
identical(all.equal(x1, x2), TRUE) # TRUE everywhere
```

Inspired by [R FAQ 7.31](http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f) and [this Stack Overflow answer](http://stackoverflow.com/a/2769618/1380598), this package provides new relational operators useful for performing floating point number comparisons with a set tolerance:
Inspired by [R FAQ 7.31](https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f) and [this Stack Overflow answer](https://stackoverflow.com/a/2769618/1380598), this package provides new relational operators useful for performing floating point number comparisons with a set tolerance:

**`fpCompare`**[^1] | **`base`**
--------------------|-----------
Expand Down
11 changes: 7 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ environment:
- R_VERSION: release

- R_VERSION: oldrel
RTOOLS_VERSION: 33
RTOOLS_VERSION: 34

- R_VERSION: 3.4.0
RTOOLS_VERSION: 34

- R_VERSION: 3.3.0
RTOOLS_VERSION: 33

- R_VERSION: 3.2.5
- R_VERSION: 3.2.0
RTOOLS_VERSION: 32

- R_VERSION: 3.1.2
- R_VERSION: 3.1.0
RTOOLS_VERSION: 31
CRAN: http://cran.rstudio.com

Expand All @@ -52,7 +55,7 @@ branches:
clone_depth: 5

build_script:
- travis-tool.sh r_binary_install knitr rmarkdown testthat
- travis-tool.sh r_binary_install knitr rmarkdown stringi testthat
- travis-tool.sh install_deps

test_script:
Expand Down
48 changes: 29 additions & 19 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,56 @@

In this version I have:

* updated the maintainer's email address
* switched to using `rmarkdown::render` for vignettes
* updated the maintainer's email address, about which I emailed CRAN on March 28, 2018.

## Test environments

### Previous R versions
* Windows 7 (local), R 3.1.2
* Windows 7 (local), R 3.1.3
* Windows 7 (local), R 3.2.0
* Windows 7 (local), R 3.2.1
* Ubuntu 14.04 (travis-ci), R 3.1.0
* Ubuntu 14.04 (travis-ci), R 3.2.0
* Ubuntu 14.04 (travis-ci), R 3.3.0
* Ubuntu 14.04 (travis-ci), R 3.4.0
* Windows (appveyor), R 3.1.0
* Windows (appveyor), R 3.2.0
* Windows (appveyor), R 3.3.0
* Windows (appveyor), R 3.4.0

### Current R versions
* OS X Yosemite (local), R 3.2.2
* Ubuntu 12.04 (travis-ci), R 3.2.2
* Windows 7 (local), R 3.2.2
* Windows (win-builder), R 3.2.2
* macOS High Sierra (local), R 3.5.0
* OS X El Capitan (travis-ci), R 3.5.0
* Ubuntu 14.04 (travis-ci), R 3.5.0
* Ubuntu 18.04 (local), R 3.5.0
* Windows (appveyor), R 3.5.0
* Windows (win-builder), R 3.5.0
* Windows 7 (local), R 3.5.0

### Development R version
* Debian:testing (rocker/r-devel), R 3.3.0 (2015-08-26 r69190)
* Windows (win-builder), R 3.3.0 (2015-09-01 r69241)
* Ubuntu 14.04 (travis-ci), R 3.6.0 (2018-06-05 r74851)
* Ubuntu 18.04 (local), R 3.6.0 (2018-06-05 r74852)
* Windows (appveyor), R 3.6.0 (2018-06-05 r74852)
* Windows (win-builder), R 3.6.0 (2018-06-05 r74852)

## R CMD check results

There were no ERRORs or WARNINGs

There was 1 NOTE:

1. Maintainer's email address has changed.
1. Maintainer's email address has changed (notified CRAN 2018-05-28).

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Alex M Chubaty <alexander.chubaty@canada.ca>'
Maintainer: 'Alex M Chubaty <alex.chubaty@gmail.com>'

New maintainer:
Alex M Chubaty <alexander.chubaty@canada.ca>
Alex M Chubaty <alex.chubaty@gmail.com>
Old maintainer(s):
Alex M Chubaty <[email protected].ca>
Alex M Chubaty <alexander.chubaty@canada.ca>

## Downstream dependencies

I have run R CMD check on downstream dependencies of `fpCompare`, and all have passed.
Summary at https://github.com/PredictiveEcology/fpCompare/blob/master/revdep/summary.md.
I have run R CMD check on downstream dependencies of `fpCompare`, and all have passed except those noted below.
Summary at https://github.com/PredictiveEcology/fpCompare/blob/master/revdep/README.md.

* `SpaDES.core` produces an error due to a non-CRAN package in Suggests, but passes once that dependency is installed.
* `SpaDES.tools` produces an error due to an unrelated error in that package. I am a developer of `SpaDES.tools` and am preparing a fixed version for CRAN which will be submitted soon.

* NOTE: `SpaDES` produces an error due to a non-CRAN package in Suggests, but passes once that dependency is installed.
Loading

0 comments on commit 4d45239

Please sign in to comment.