[R] Mean calculated from R1.9.1 different from R2.0.1

Chang-Heok Soh csoh at hsph.harvard.edu
Thu Feb 10 09:44:35 CET 2005


Hello,
I ran my simulations on the Unix verson of R1.9.1 and the Windows version
of R2.0.1 on XP.  I kept getting different values for the mean of the same
column of the same matrix, and am perplexed.  I would appreciate if anyone
could help explain the difference?

Here is a sample code:

set.seed(7293)
z1v <- rnorm(1000, mean=68, sd=13)
z1v <- (z1v-mean(z1v))/sd(z1v)

Using R1.9.1 on Unix, I get:

mean(z1v)
[1] -4.88775e-15

Using R2.0.1 on Windows XP, I get:

mean(z1v)
[1] -3.7497e-16

The same problem occurs when I dump the data from one version and
then source it using the other version.

Thanks for the help.

Regards,
Chang-Heok




More information about the R-help mailing list