Rounding in print.summaryDefault()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rounding in print.summaryDefault()

Arne Henningsen-3
Dear all

I am happy that summary.default() no longer rounds since R 3.4.0.

However, in R 3.4.0, in a few cases, print.summaryDefault() rounds the
mean value (and the median value) differently on my GNU/Linux machine
and on my colleague's MS-Windows machine. Here is a small (simplified)
reproducible example:

R> a <- 1234568.01 + c(0:1)
R> summary(a)

Output on MS-Windows (expected rounding of the mean value):
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1234568 1234568 1234569 1234569 1234569 1234569

Output on GNU/Linux (unexpected rounding of the mean value):
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1234568 1234568 1234568 1234568 1234569 1234569

The following code gives the same output on MS-Windows and on GNU/Linux:
R> print(summary(a), digits=9)
    Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
1234568.0 1234568.3 1234568.5 1234568.5 1234568.8 1234569.0
R> summary(a)["Mean"]
  Mean
1234569
R> mean(a)
[1] 1234569
R> print(mean(a), digits=9)
[1] 1234568.51

Can these outputs be reproduced by other GNU/Linux and MS-Windows users?

If these differences can be reproduced by others: Should these
differences in the output on GNU/Linux and MS-Windows be considered as
a bug?

Does anybody know how one can avoid to get different roundings in the
outputs of summary() on different computers?

Best,
Arne

--
Arne Henningsen
http://www.arne-henningsen.name

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rounding in print.summaryDefault()

Dirk Eddelbuettel

On 28 May 2017 at 17:37, Arne Henningsen wrote:
| Dear all
|
| I am happy that summary.default() no longer rounds since R 3.4.0.
|
| However, in R 3.4.0, in a few cases, print.summaryDefault() rounds the
| mean value (and the median value) differently on my GNU/Linux machine
| and on my colleague's MS-Windows machine. Here is a small (simplified)
| reproducible example:
|
| R> a <- 1234568.01 + c(0:1)
| R> summary(a)
|
| Output on MS-Windows (expected rounding of the mean value):
|    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
| 1234568 1234568 1234569 1234569 1234569 1234569
|
| Output on GNU/Linux (unexpected rounding of the mean value):
|    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
| 1234568 1234568 1234568 1234568 1234569 1234569

Not here:

R> a <- 1234568.01 + c(0:1)
R> a
[1] 1234568 1234569
R> summary(a)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1234568 1234568 1234569 1234569 1234569 1234569
R> Sys.info()
                                      sysname
                                      "Linux"
                                      release
                           "4.8.0-39-generic"
                                      version
"#42-Ubuntu SMP Mon Feb 20 11:47:27 UTC 2017"
                                     nodename
                                        "max"
                                      machine
                                     "x86_64"
                                        login
                                        "edd"
                                         user
                                        "edd"
                               effective_user
                                        "edd"
R>

Ubuntu 16.10, 64bit.

Dirk
 
| The following code gives the same output on MS-Windows and on GNU/Linux:
| R> print(summary(a), digits=9)
|     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
| 1234568.0 1234568.3 1234568.5 1234568.5 1234568.8 1234569.0
| R> summary(a)["Mean"]
|   Mean
| 1234569
| R> mean(a)
| [1] 1234569
| R> print(mean(a), digits=9)
| [1] 1234568.51
|
| Can these outputs be reproduced by other GNU/Linux and MS-Windows users?
|
| If these differences can be reproduced by others: Should these
| differences in the output on GNU/Linux and MS-Windows be considered as
| a bug?
|
| Does anybody know how one can avoid to get different roundings in the
| outputs of summary() on different computers?
|
| Best,
| Arne
|
| --
| Arne Henningsen
| http://www.arne-henningsen.name
|
| ______________________________________________
| [hidden email] mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

--
http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rounding in print.summaryDefault()

Joris FA Meys
In reply to this post by Arne Henningsen-3
Weird, because the output of Windows is actually correct. The exact mean of
a is 1234568.51, which rounds to 1234569.

I can reproduce the Windows output on a Windows machine. My Debian server
has R 3.3.1 , and there I can reproduce your output using:

> summary(a, digits = 8)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1234568 1234568 1234568 1234568 1234569 1234569

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base



On Sun, May 28, 2017 at 5:37 PM, Arne Henningsen <[hidden email]>
wrote:

> Dear all
>
> I am happy that summary.default() no longer rounds since R 3.4.0.
>
> However, in R 3.4.0, in a few cases, print.summaryDefault() rounds the
> mean value (and the median value) differently on my GNU/Linux machine
> and on my colleague's MS-Windows machine. Here is a small (simplified)
> reproducible example:
>
> R> a <- 1234568.01 + c(0:1)
> R> summary(a)
>
> Output on MS-Windows (expected rounding of the mean value):
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 1234568 1234568 1234569 1234569 1234569 1234569
>
> Output on GNU/Linux (unexpected rounding of the mean value):
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 1234568 1234568 1234568 1234568 1234569 1234569
>
> The following code gives the same output on MS-Windows and on GNU/Linux:
> R> print(summary(a), digits=9)
>     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
> 1234568.0 1234568.3 1234568.5 1234568.5 1234568.8 1234569.0
> R> summary(a)["Mean"]
>   Mean
> 1234569
> R> mean(a)
> [1] 1234569
> R> print(mean(a), digits=9)
> [1] 1234568.51
>
> Can these outputs be reproduced by other GNU/Linux and MS-Windows users?
>
> If these differences can be reproduced by others: Should these
> differences in the output on GNU/Linux and MS-Windows be considered as
> a bug?
>
> Does anybody know how one can avoid to get different roundings in the
> outputs of summary() on different computers?
>
> Best,
> Arne
>
> --
> Arne Henningsen
> http://www.arne-henningsen.name
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



--
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel :  +32 (0)9 264 61 79
[hidden email]
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rounding in print.summaryDefault()

Joris FA Meys
In reply to this post by Dirk Eddelbuettel
Might this be related to the Linux version? I'm testing on one of our
university servers, and they tend to be deprived of regular updates
sometimes... (Dirk, sorry for sending you this twice.)

> Sys.info()
                                    sysname
                                    "Linux"
                                    release
                           "3.16.0-4-amd64"
                                    version
"#1 SMP Debian 3.16.7-ckt11-1 (2015-05-24)"
                                   nodename
                                  "ourServer"
                                    machine
                                   "x86_64"
                                      login
                                   "me"
                                       user
                                   "me"
                             effective_user
                                   "me"

On Sun, May 28, 2017 at 5:51 PM, Dirk Eddelbuettel <[hidden email]> wrote:

>
> On 28 May 2017 at 17:37, Arne Henningsen wrote:
> | Dear all
> |
> | I am happy that summary.default() no longer rounds since R 3.4.0.
> |
> | However, in R 3.4.0, in a few cases, print.summaryDefault() rounds the
> | mean value (and the median value) differently on my GNU/Linux machine
> | and on my colleague's MS-Windows machine. Here is a small (simplified)
> | reproducible example:
> |
> | R> a <- 1234568.01 + c(0:1)
> | R> summary(a)
> |
> | Output on MS-Windows (expected rounding of the mean value):
> |    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> | 1234568 1234568 1234569 1234569 1234569 1234569
> |
> | Output on GNU/Linux (unexpected rounding of the mean value):
> |    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> | 1234568 1234568 1234568 1234568 1234569 1234569
>
> Not here:
>
> R> a <- 1234568.01 + c(0:1)
> R> a
> [1] 1234568 1234569
> R> summary(a)
>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 1234568 1234568 1234569 1234569 1234569 1234569
> R> Sys.info()
>                                       sysname
>                                       "Linux"
>                                       release
>                            "4.8.0-39-generic"
>                                       version
> "#42-Ubuntu SMP Mon Feb 20 11:47:27 UTC 2017"
>                                      nodename
>                                         "max"
>                                       machine
>                                      "x86_64"
>                                         login
>                                         "edd"
>                                          user
>                                         "edd"
>                                effective_user
>                                         "edd"
> R>
>
> Ubuntu 16.10, 64bit.
>
> Dirk
>
> | The following code gives the same output on MS-Windows and on GNU/Linux:
> | R> print(summary(a), digits=9)
> |     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
> | 1234568.0 1234568.3 1234568.5 1234568.5 1234568.8 1234569.0
> | R> summary(a)["Mean"]
> |   Mean
> | 1234569
> | R> mean(a)
> | [1] 1234569
> | R> print(mean(a), digits=9)
> | [1] 1234568.51
> |
> | Can these outputs be reproduced by other GNU/Linux and MS-Windows users?
> |
> | If these differences can be reproduced by others: Should these
> | differences in the output on GNU/Linux and MS-Windows be considered as
> | a bug?
> |
> | Does anybody know how one can avoid to get different roundings in the
> | outputs of summary() on different computers?
> |
> | Best,
> | Arne
> |
> | --
> | Arne Henningsen
> | http://www.arne-henningsen.name
> |
> | ______________________________________________
> | [hidden email] mailing list
> | https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



--
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel :  +32 (0)9 264 61 79
[hidden email]
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rounding in print.summaryDefault()

Arne Henningsen-3
Thanks for all your responses. The issue seems to be more complex than
I thought. Here is the output of Sys.info() and sessionInfo() on my
GNU/Linux machine (Ubuntu 16.04.02 LTS):

R> a <- 1234568.01 + c(0:1)
R> a
[1] 1234568 1234569
R> summary(a)
  Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1234568 1234568 1234568 1234568 1234569 1234569
R> Sys.info()
                                        sysname
                                        "Linux"
                                        release
                      "4.5.0-040500rc6-generic"
                                        version
"#201602281230 SMP Sun Feb 28 17:33:02 UTC 2016"
                                       nodename
                             "arne-HP-EB-8560w"
                                        machine
                                       "x86_64"
                                          login
                                         "arne"
                                           user
                                         "arne"
                                 effective_user
                                         "arne"
R> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
[1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
[3] LC_TIME=da_DK.UTF-8        LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=da_DK.UTF-8    LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=da_DK.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0


/Arne


On 28 May 2017 at 17:58, Joris Meys <[hidden email]> wrote:

> Might this be related to the Linux version? I'm testing on one of our
> university servers, and they tend to be deprived of regular updates
> sometimes... (Dirk, sorry for sending you this twice.)
>
>> Sys.info()
>                                     sysname
>                                     "Linux"
>                                     release
>                            "3.16.0-4-amd64"
>                                     version
> "#1 SMP Debian 3.16.7-ckt11-1 (2015-05-24)"
>                                    nodename
>                                   "ourServer"
>                                     machine
>                                    "x86_64"
>                                       login
>                                    "me"
>                                        user
>                                    "me"
>                              effective_user
>                                    "me"
>
> On Sun, May 28, 2017 at 5:51 PM, Dirk Eddelbuettel <[hidden email]> wrote:
>>
>>
>> On 28 May 2017 at 17:37, Arne Henningsen wrote:
>> | Dear all
>> |
>> | I am happy that summary.default() no longer rounds since R 3.4.0.
>> |
>> | However, in R 3.4.0, in a few cases, print.summaryDefault() rounds the
>> | mean value (and the median value) differently on my GNU/Linux machine
>> | and on my colleague's MS-Windows machine. Here is a small (simplified)
>> | reproducible example:
>> |
>> | R> a <- 1234568.01 + c(0:1)
>> | R> summary(a)
>> |
>> | Output on MS-Windows (expected rounding of the mean value):
>> |    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>> | 1234568 1234568 1234569 1234569 1234569 1234569
>> |
>> | Output on GNU/Linux (unexpected rounding of the mean value):
>> |    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>> | 1234568 1234568 1234568 1234568 1234569 1234569
>>
>> Not here:
>>
>> R> a <- 1234568.01 + c(0:1)
>> R> a
>> [1] 1234568 1234569
>> R> summary(a)
>>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>> 1234568 1234568 1234569 1234569 1234569 1234569
>> R> Sys.info()
>>                                       sysname
>>                                       "Linux"
>>                                       release
>>                            "4.8.0-39-generic"
>>                                       version
>> "#42-Ubuntu SMP Mon Feb 20 11:47:27 UTC 2017"
>>                                      nodename
>>                                         "max"
>>                                       machine
>>                                      "x86_64"
>>                                         login
>>                                         "edd"
>>                                          user
>>                                         "edd"
>>                                effective_user
>>                                         "edd"
>> R>
>>
>> Ubuntu 16.10, 64bit.
>>
>> Dirk
>>
>> | The following code gives the same output on MS-Windows and on GNU/Linux:
>> | R> print(summary(a), digits=9)
>> |     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
>> | 1234568.0 1234568.3 1234568.5 1234568.5 1234568.8 1234569.0
>> | R> summary(a)["Mean"]
>> |   Mean
>> | 1234569
>> | R> mean(a)
>> | [1] 1234569
>> | R> print(mean(a), digits=9)
>> | [1] 1234568.51
>> |
>> | Can these outputs be reproduced by other GNU/Linux and MS-Windows users?
>> |
>> | If these differences can be reproduced by others: Should these
>> | differences in the output on GNU/Linux and MS-Windows be considered as
>> | a bug?
>> |
>> | Does anybody know how one can avoid to get different roundings in the
>> | outputs of summary() on different computers?
>> |
>> | Best,
>> | Arne
>> |
>> | --
>> | Arne Henningsen
>> | http://www.arne-henningsen.name
>> |
>> | ______________________________________________
>> | [hidden email] mailing list
>> | https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> --
>> http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Mathematical Modelling, Statistics and Bio-Informatics
>
> tel :  +32 (0)9 264 61 79
> [hidden email]
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



--
Arne Henningsen
http://www.arne-henningsen.name

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...