Re: [Rd] Function 'factor' issues

2017-10-18 Thread Gabriel Becker
Martin, Suharto, et al., On Wed, Oct 18, 2017 at 9:54 AM, Martin Maechler wrote: > ** > > > Note: In theory, if function 'factor' merged duplicated 'labels' in > all cases, at least in > > factor(c(sqrt(2)^2, 2)) , > > function 'factor' could do matching on original 'x' (without >

Re: [Rd] Function 'factor' issues

2017-10-18 Thread Martin Maechler
> Suharto Anggono Suharto Anggono via R-devel > on Sun, 15 Oct 2017 16:03:48 + writes: > In R devel, function 'factor' has been changed, allowing and merging duplicated 'labels'. Indeed. That had been asked for and discussed a bit on this list from June 14 to June 23, start

Re: [Rd] Another issue with Sys.timezone

2017-10-18 Thread Martin Maechler
> Martin Maechler > on Mon, 16 Oct 2017 19:13:31 +0200 writes: > Stephen Berman > on Sun, 15 Oct 2017 01:53:12 +0200 writes: > > (I reported the test failure mentioned below to R-help but was advised > > that this list is the right one to address the issue; in th

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
The binary tree algorithm does not need additional scrambling. I have written the R code for the algorithm in the last answer at: https://stackoverflow.com/questions/311703/algorithm-for-sampling-without-replacement/46807110#46807110 However, the algorithm will probably be outperformed by hash t

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
Thank you for your answer. Certainly, hash table must be faster than binary tree. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread William Dunlap via R-devel
Splus used a similar method for sampling from "bigdata" objects. One problem was that sample() is used both for creating a sample and for scrambling the order of a vector. Scrambling the order of a big vector wastes time. It would be nice to be able to tell sample() that we don't care about the

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Radford Neal
> From: "Pavel S. Ruzankin" > Let us consider the current uniform sampling without replacement > algorithm. It resides in function do_sample in > https://svn.r-project.org/R/trunk/src/main/random.c > Its complexity is obviously O(n), where the sample is selected from > 1...n, since the algorith

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
See also: P. Gupta, G. P. Bhattacharjee. (1984) An efficient algorithm for random sampling without replacement. International Journal of Computer Mathematics 16:4, pages 201-209. http://dx.doi.org/10.1080/00207168408803438 Teuhola, J. and Nevalainen, O. 1982. Two efficient algorithms for random

[Rd] A wrapper of seq.Date() encounters an issue

2017-10-18 Thread Earo Wang
Hello, I’ve tried to have a wrapper function of seq.Date(), saying seq_date(). The seq_date() function takes exactly the same arguments and the defaults as seq.Date(). The seq_date() is expected to return the same results as seq.Date(), but it triggers an error in seq.Date(). The little reproducib

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
If somebody is interested I can write the code. But somebody else has to add the code for handling int / long int / double cases, since I do not have enough experience in that. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinf