waith
waith

Reputation: 21

Different results even with set.seed() in R

I have re-run with the same seed but cannot produce same results in R studio.

Will set.seed() lose track when calling different user packages, R6 classes and methods?

Have you come across similar situation and how to fix it?

Thanks a lot

closeAllConnections()
rm(list=ls())
gc()

set.seed(123456)
require(PackageA)  #user defined package

fileName <- "N:/Risk Management/abc.json";

configuration <- JsonConfigurationReader$readConfiguration(fileName); #R6 class and method in PackageA

instance <- someClass$new(configuration); #R6 class and method in PackageA

instance$execute()  #will produce some random numbers in this method

closeAllConnections()
rm(list=ls())
gc()

Upvotes: 0

Views: 7738

Answers (1)

Rahul
Rahul

Reputation: 11

The issue would come if you are using diffrent R versions (3.5 vs 3.6 and above). The version upto 3.5 will show same results but for the same code the versions 3.6 will show a diffrent results. However version 3.6 and 4.0 will have same results.

Upvotes: 1

Related Questions