[R-pkg-devel] Running tests on 32-bit and 64-bit

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Mon Aug 17 14:21:38 CEST 2015


Perhaps related: in the Bioconductor minfi package I do some checking on
somewhat large matrices (450,000 times n).  To save space, I compute a hash
of the correct result using the digest package.  As you, I ran into obvious
issues with precision across platforms.  To solve this, I take the matrix
and run it through sprintf() with (my choice) 6 digits and then I hash the
resulting character matrix.  It works pretty nice for my purpose.

You find minfi on github.  Code is in
  inst/unitTests/test_preprocess.R  (testing using Runit)
  inst/testData/testData/testData_preprocessQuantile.R (creating the
reference "correct" matrix - this is only intended to be re-run when the
algorithm change)
  R/utils.R for the two convenience functions .digestMatrix and
.digestVector

Best,
Kasper

On Mon, Aug 17, 2015 at 5:03 AM, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:

> Dear all,
>
> Is there an easy way to run the tests of a package on both a 32-bit and
> 64-bit version? Ideally it should work when using R CMD check --as-cran on
> all OS's. Although I expect that multi architecture versions are only
> available on windows. So a Windows only solution will be fine as well.
>
> The origin of the problem is that I calculate some SHA1 hashed on objects
> containing floating point numbers. The floating points have different
> precision on 32-bit and 64-bit, and thus different hashes. I'm trying to
> work around that problem. And thus need an easy way to run tests on both
> 32-bit and 64-bit.
>
> Best regards,
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list