Same data, same code, different result == not reproducible research!

Background, I'm a finance guy who loves R. I have a small company. Just hired a someone and set him up on R. Oddly, when we try to knit a pdf file using the same rmd file with the same data we get different results. And this one is both especially weird and beyond my sleuthing capabilities. In short, the code reads an Excel file and writes out a value from one of the cells. From my PC, it looks like it should "100,000". From his, it appears as "1e+05". The question is how do I make the output "100,000" from both computers? As you look at the code you will see that I'm printing a vector using the code

av$PreTaxValue <- prettyNum(round(av$PreTaxValue, 0), big.mark = ",")

It's odd that one number in the vector is in scientific notation, and the other have the comma.

The code (.rmd file), the Excel data, and the two (one from each computer) PDF output into Github repo. Any help appreciated.

Additional details: we both installed tinytex. R.Version() from my PC produces:

$platform
[1] "x86_64-w64-mingw32"

$arch
[1] "x86_64"

$os
[1] "mingw32"

$system
[1] "x86_64, mingw32"

$status
[1] ""

$major
[1] "3"

$minor
[1] "5.1"

$year
[1] "2018"

$month
[1] "07"

$day
[1] "02"

$svn rev
[1] "74947"

$language
[1] "R"

$version.string
[1] "R version 3.5.1 (2018-07-02)"

$nickname
[1] "Feather Spray"

From my colleague's PC: R.Version() produces:
$platform

[1] "x86_64-w64-mingw32"

$arch

[1] "x86_64"

$os

[1] "mingw32"

$system

[1] "x86_64, mingw32"

$status

[1] ""

$major

[1] "3"

$minor

[1] "5.1"

$year

[1] "2018"

$month

[1] "07"

$day

[1] "02"

$svn rev

[1] "74947"

$language

[1] "R"

$version.string

[1] "R version 3.5.1 (2018-07-02)"

$nickname

[1] "Feather Spray"

Try str(options()) to check if you are using the same global options.
Try sessionInfo() to check if you have the same package version installed on both machines.

This sounds like you both have different locales.

I suspect this has nothing to do with R (or RMarkdown), but with the locales of your respective computers that are being used by your LaTeX distributions.

Well, you get the same result but written in different formats. Something that might be annoying aesthetically (and that you might be able to sort by looking at the locales you both have or at some other settings inside or outside of R), but that does not get in the way of reproducible research.

2 Likes