[R] function sample: diferences across R versions

Patrick (Malone Quantitative) m@|one @end|ng |rom m@|onequ@nt|t@t|ve@com
Wed Jul 31 00:55:00 CEST 2019


My understanding is that sample() in 3.6.0 did, in fact, change in
ways that detach it from set.seed().

You can use RNGkind() or RNGversion() to recapture the old behavior.

See https://cran.rstudio.com/bin/windows/base/NEWS.R-3.6.1.html in the
section CHANGES IN R 3.6.0 .

Also, please do not post in HTML.

Pat

On Tue, Jul 30, 2019 at 6:45 PM Jose Claudio Faria
<joseclaudio.faria using gmail.com> wrote:
>
> Hi,
> I just noticed the difference in a teaching data generation script between
> version 3.6.1 and earlier.
>
> #! R version 3.4.3
> set.seed(2019); sample(1:10, 1)
> [1] 8
>
> #! R version 3.5.1patched
> set.seed(2019); sample(1:10, 1)
> [1] 8
>
> #! R version 3.5.3patched
> set.seed(2019); sample(1:10, 1)
> [1] 8
>
> #! R version 3.6.0patched
> set.seed(2019); sample(1:10, 1)
> [1] 8
>
> #! R version 3.6.1patched
> set.seed(2019); sample(1:10, 1)
> [1] 9  # <--------------------------------- Here!
>
> Is it a bug?
> if not (is a new feature) how can I maintain compatibility between version
> 3.6.1 and all others?
>
> Regards,
> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
> Jose Claudio Faria
> UESC/DCET/Brasil
> joseclaudio.faria at gmail.com
> Telefones:
> 55(73)3680.5545 - UESC
> 55(73)99966.9100 - VIVO
> ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
>
> If you have software to deal with statistics, you have arms;
> if you have good software, you have arms and legs;
> if you have software like R, you have arms, legs and wings...
> the height of your flight depends only on you!
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list