[R] function sample: diferences across R versions

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Jul 31 03:00:16 CEST 2019


There seem to be a couple of ways to do this.

Rngkind( sample.kind="Rounding" )

or

RNGversion("3.5.2")

per

?Random

https://stat.ethz.ch/pipermail/r-help/2019-June/463109.html

On July 30, 2019 5:31:13 PM PDT, Jose Claudio Faria <joseclaudio.faria using gmail.com> wrote:
>Thanks Patrick.
>
>I took a look at the documentation of the RNGkind and RNGversion
>functions but didn't understand how they work. Can you exemplify how I
>can, through them, to recapture the old behavior?
>
>Best,
>///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
>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!
>
>Em ter, 30 de jul de 2019 às 19:56, Patrick (Malone Quantitative)
><malone using malonequantitative.com> escreveu:
>>
>> Poorly phrased--makes it act differently with respect to set.seed() .
>>
>> On Tue, Jul 30, 2019 at 6:55 PM Patrick (Malone Quantitative)
>> <malone using malonequantitative.com> wrote:
>> >
>> > 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.
>
>______________________________________________
>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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list