2

I run some R simulation I wrote before now but gets different results from same version of R. I tried such simulation on a web interface and I got the previous result. What must have changed on my windows 10?

set.seed(1)
rnorm(20)

#[1] -0.62645381  0.18364332 -0.83562861  1.59528080  0.32950777 -0.82046838
 #[7]  0.48742905  0.73832471  0.57578135 -0.30538839  1.51178117  0.38984324
#[13] -0.62124058 -2.21469989  1.12493092 -0.04493361 -0.01619026  0.94383621
#[19]  0.82122120  0.59390132

as against my new result

#[1]  0.46081080  1.34310205  0.99716829 -0.36762421 -0.13198270  1.77709933 -0.46426860 -0.17384681 -0.40401399
#[10]  1.41481488  0.03121604 -1.28415064  0.58393330 -2.06891059  0.12002295 -3.25983598 -0.41697647 -0.51721040
#[19]  0.89266537  1.33231147

I triad same on a mobile app called

R compiler

I got exactly the result

#[1] -0.62645381  0.18364332 -0.83562861  1.59528080  0.32950777 -0.82046838
 #[7]  0.48742905  0.73832471  0.57578135 -0.30538839  1.51178117  0.38984324
#[13] -0.62124058 -2.21469989  1.12493092 -0.04493361 -0.01619026  0.94383621
#[19]  0.82122120  0.59390132

I now know that my windows 10 has effect on my R result.

My question is what must have changed on my Windows that is affecting my R result?

Daniel James
  • 1,381
  • 1
  • 10
  • 28
  • 1
    Well that's weird! I can conform the one starting with -0.62645381, 0.18364332 ... here. – jay.sf Jan 23 '21 at 05:31
  • 1
    Are you loading any other packages? Are you restoring a workspace at startup? What R version is this? Is there any other code at all being run? Do you have anything in your .Rprofile? – MrFlick Jan 23 '21 at 06:08
  • I am using `R` 4.0.3, it happens either or not I load package like in the case of `rnorm(20)` that I load no package. – Daniel James Jan 23 '21 at 07:57
  • What does `RNGkind()` return for both R versions? – MrFlick Jan 23 '21 at 18:45
  • RNGkind() [1] "L'Ecuyer-CMRG" "Inversion" "Rounding" ###for my Windows 10 – Daniel James Jan 25 '21 at 01:01
  • RNGkind() [1] "LMersenne -Twister" "Inversion" ### for my android – Daniel James Jan 25 '21 at 01:04
  • R.version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 4 minor 0.3 year 2020 month 10 day 10 svn rev 79318 language R version.string R version 4.0.3 (2020-10-10) nickname Bunny-Wunnies Freak Out – Daniel James Jan 25 '21 at 01:15

1 Answers1

1

I read all comments on this question and it greatly inspired me to look inwards. I got

file.remove(".RData")
q("no")

from Random Number Generator for R 3.6.1 and it solved my problem

Daniel James
  • 1,381
  • 1
  • 10
  • 28