Re: [Rd] portable parallel seeds project: request for critiques

2012-03-02 Thread Petr Savicky
that it produces output, which is computationally hard to distinguish from truly random numbers. For this purpose, i suggest to use the package rngSetSeed provided currently at http://www.cs.cas.cz/~savicky/randomNumbers/ It is based on AES and Fortuna similarly as randaes, but these components

Re: [Rd] portable parallel seeds project: request for critiques

2012-03-02 Thread Petr Savicky
algorithms to break it. However, if you use it for a simulation, then the simulation will be biased only if it contains an algorithm, which breaks MD5. The probability that this happens just by chance is small. Petr Savicky. __ R-devel@r-project.org mailing list

Re: [Rd] portable parallel seeds project: request for critiques

2012-03-02 Thread Petr Savicky
, it is better to use the array initialization even for a single number seed. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] OpenMP and random number generation

2012-02-22 Thread Petr Savicky
information about that. Package CORElearn (i am a coauthor) uses random number generation under OpenMP in C++. This requires to have a separate copy of the generator with its own memory for each thread. Do you want to use it in C or C++? Petr Savicky

Re: [Rd] portable parallel seeds project: request for critiques

2012-02-22 Thread Petr Savicky
On Wed, Feb 22, 2012 at 12:17:25PM -0600, Paul Johnson wrote: [...] In order for this to be easy for users, I need to put the init streams and set current stream functions into a package, and then streamline the process of creating the seed array. My opinion is that CRAN is now overflowed

Re: [Rd] portable parallel seeds project: request for critiques

2012-02-21 Thread Petr Savicky
is [,1] seed1 124370417 seed2 205739774 FALSE TRUE 5 994 This means that if the streams x, y are generated from the two seeds above, then y is almost exactly equal to x shifted by 1. What is the current state of your project? Petr Savicky

Re: [Rd] portable parallel seeds project: request for critiques

2012-02-18 Thread Petr Savicky
exactly. I hope. Saving .Random.seed should be a safe strategy. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] portable parallel seeds project: request for critiques

2012-02-17 Thread Petr Savicky
is the maximum for a single integer seed. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] matrix not positive definite (while it should be)

2011-05-06 Thread Petr Savicky
the distribution uniquely, this is also a description of the required distribution. The distribution is concentrated in a 2 dimensional subspace, since the covariance matrix has rank 2. Hope this helps. Petr Savicky. __ R-devel@r-project.org mailing

Re: [Rd] duplicates() function

2011-04-12 Thread Petr Savicky
out1 FALSE TRUE 94258 For a numeric matrix, the ratio of the running times is larger in the same direction. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] duplicates() function

2011-04-09 Thread Petr Savicky
the vector to the original order of the rows. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] testing presence of pdflatex in R CMD check

2011-03-25 Thread Petr Savicky
... looks like a package You may want to clean up by 'rm -rf /tmp/RtmpQ0WawT/Rd2pdf41481e1' Is it intentional not to test the presence of pdflatex during R CMD check? Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [Rd] round, unique and factor

2011-03-21 Thread Petr Savicky
for breakage is higer, however. Can you describe the error in more detail? Is it related to consistency of converting a number to character and back? Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] unique.matrix issue [Was: Anomaly with unique and match]

2011-03-12 Thread Petr Savicky
] 2 nrow(unique(cbind(9*x))) [1] 4 Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] unique.matrix issue [Was: Anomaly with unique and match]

2011-03-10 Thread Petr Savicky
712 Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Anomaly with unique and match

2011-03-09 Thread Petr Savicky
vectors and uses a transformation of the column using rank(). For example, temp3 - as.matrix(rank(temp1, ties.method=max)) match(temp3, unique(temp3)) [1] 1 2 3 4 4 5 6 7 7 7 6 6 6 8 8 8 6 6 6 9 9 9 6 6 Can this be used in your code? Petr Savicky

[Rd] error in memCompress() in make check

2011-02-22 Thread Petr Savicky
grDevices utils datasets methods base gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46) Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] error in memCompress() in make check

2011-02-22 Thread Petr Savicky
) do not produce an error, if the compiled R runs in the same shell, where make check was run. However, they produce the error, if R is started in a new shell. The command find /usr -name liblzma* has empty output. Petr Savicky. __ R-devel@r

Re: [Rd] R command line and pipe using in Linux?

2011-02-14 Thread Petr Savicky
Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] print(...,digits=2) behavior

2011-02-13 Thread Petr Savicky
, 9.995001) for (x in example4) print(x, digits=7) [1] 9.99 [1] 10 I appreciate comments. Petr Savicky. ###--- R function that does the same as 'scientific' in ###--- /usr/local/R-0.50/src/main/format.c ###--- ~~~||~~ scientific1 - function(x

Re: [Rd] R 2.12.1 Windows 32bit and 64bit - are numerical differences expected?

2011-02-10 Thread Petr Savicky
results on different platforms, however, it cannot be generally guaranteed. For tree construction, even minor differences in rounding may influence comparisons and this may result in a different form of the tree. Petr Savicky. __ R-devel@r-project.org

Re: [Rd] print(...,digits=2) behavior

2011-02-09 Thread Petr Savicky
on this. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] print(...,digits=2) behavior

2011-02-07 Thread Petr Savicky
are (6 - 5.9994)/5.9994 [1] 0.00010001 (6 - 5.9994001)/5.9994001 [1] 9.999333e-05 Here, one digit output is chosen if the relative error is less than 10^-4 and not otherwise. Petr Savicky. __ R-devel@r-project.org mailing list https

Re: [Rd] Wait for user input with readline()

2010-12-07 Thread Petr Savicky
of the user input. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] opening graphics device with a given number

2010-11-13 Thread Petr Savicky
of the device numbers, but sometimes, it could be useful to open, say, device 4, even if device 3 is not needed. Is there a way, how to open a device with a given number without opening devices with smaller numbers? Petr Savicky. __ R-devel@r-project.org

Re: [Rd] opening graphics device with a given number

2010-11-13 Thread Petr Savicky
it. Thank you very much for this information. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] .Call and .C arguments

2010-03-29 Thread Petr Savicky
at the R level is, actually formatC(1204.245, digits=20) # [1] 1204.24498909 See http://rwiki.sciviews.org/doku.php?id=misc:r_accuracy or FAQ 7.31 for more examples. Petr Savicky. Is there a way to pass the arguments differently? I'm using Windows and Visual Studio C++ 2005

Re: [Rd] Associative array?

2010-03-11 Thread Petr Savicky
of a double x to character type, which preserves the number exactly, may be obtained, for example, using formatC(x, digits=17, width=-1) Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] choose(n,k) when n is almost integer

2010-02-03 Thread Petr Savicky
On Tue, Feb 02, 2010 at 01:37:46PM +0100, Petr Savicky wrote: I would like to add some more information concerning the patch C to the function choose() proposed in the email https://stat.ethz.ch/pipermail/r-devel/2009-December/056177.html The patch uses transformations of choose(n, k

[Rd] missing R-devel/po

2010-01-06 Thread Petr Savicky
at https://svn.r-project.org/R/trunk/, so the problem could be just temporary. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] seq.int broken (seq as well) (PR#14169)

2009-12-31 Thread Petr Savicky
on it. This suggests that we should get double in both cases, since all three arguments from, to, and by are specified. I do not know, whether having an integer result in seq() in the above case is intended or not. Petr Savicky. __ R-devel@r-project.org mailing list

Re: [Rd] choose(n,k) when n is almost integer

2009-12-23 Thread Petr Savicky
obtained sometimes from the original implementation and which is more accurate in all ranges of the output. For testing patch C a simpler script is sufficient, since we need not to take care of the warnings. Namely http://www.cs.cas.cz/~savicky/R-devel/test_choose_1.R which produces the output

Re: [Rd] choose(n,k) when n is almost integer

2009-12-22 Thread Petr Savicky
for both patches A and B in the tests, which i did. Patch B is significantly more accurate in cases, when the result is more than 1. In order to verify these two claims, i used the test script at http://www.cs.cas.cz/~savicky/R-devel/test_choose_0.R Its outputs with A and B are presented below

Re: [Rd] choose(n,k) when n is almost integer

2009-12-22 Thread Petr Savicky
. The test was run both with Intel extended and SSE arithmetic. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] a little bug for the function 'sprintf' (PR#14161)

2009-12-21 Thread savicky
When you type in the example codes: sprintf(%s is %f feet tall\n, Sven, 7.1) and R returns: [1] Sven is 7.10 feet tall\n this is very different from the 'sprintf' function in C/C++, for in C/C++, the format string \n usually represents a new line, but here, just the plain text

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-17 Thread Petr Savicky
or their modifications can be accepted. Petr Savicky. --- R-devel_2009-12-16/src/nmath/choose.c 2008-03-17 17:52:35.0 +0100 +++ R-devel_less_conservative/src/nmath/choose.c2009-12-17 22:43:54.0 +0100 @@ -107,19 +107,20 @@ #endif if (fabs(k - k0) 1e-7

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Petr Savicky
[9,] 0.010910034 -4.5180723 -4.5180723 [10,] -0.009273529NaN -4.6805913 Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] R CMD check may not detect a code/documentation mismatch

2009-12-14 Thread Petr Savicky
(CentOS and openSUSE). On the other hand, for the package http://www.cs.cas.cz/~savicky/R-devel/something_0.0.0.tar.gz which demonstrates the problem, the modified R detected the code/doc mismatch. The diff of the two outputs of R CMD check was [savi...@uivtx test]$ diff original modified

Re: [Rd] Accuracy (PR#14139)

2009-12-14 Thread Petr Savicky
. It is designed primarily for printing vectors, where the rules are more complicated to achieve a good unified format for all numbers. May be, someone else can say more about it. The above analysis may be obtained by inspecting the R source code. Petr Savicky

Re: [Rd] Accuracy (PR#14139)

2009-12-14 Thread savicky
. It is designed primarily for printing vectors, where the rules are more complicated to achieve a good unified format for all numbers. May be, someone else can say more about it. The above analysis may be obtained by inspecting the R source code. Petr Savicky

[Rd] R CMD check may not detect a code/documentation mismatch

2009-12-13 Thread Petr Savicky
For the package at http://www.cs.cas.cz/~savicky/R-devel/something_0.0.0.tar.gz which is a minor part of some other package only to demonstrate the problem, i get (under R version 2.11.0 Under development 2009-12-12 r50714 and also under R-2.9.2, openSUSE 11.1 (x86_64) and CentOS release 5.2

Re: [Rd] cor.test(method = spearman, exact = TRUE) not exact (PR#14095)

2009-11-30 Thread Petr Savicky
On Mon, Nov 30, 2009 at 04:00:12AM +0100, dsim...@gmail.com wrote: a - c(1:10) b - c(1:10) cor.test(a, b, method = spearman, alternative = greater, exact = TRUE) Spearman's rank correlation rho data: a and b S = 0, p-value 2.2e-16 alternative hypothesis: true rho is

Re: [Rd] Unexpected behaviour of seq(from,to,by) (PR#14057)

2009-11-11 Thread Petr Savicky
] 0.5999778 See http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy for more examples and explanations. Petr Savicky. V[8] # [1] 0.7 V[8]==0.7 # [1] FALSE # Rounding!? V[9] # [1] 0.8 V[9]==0.8 # [1] TRUE # Back to normal # The generated sequence is fine for all values except

Re: [Rd] identical(0, -0)

2009-08-22 Thread Petr Savicky
On Sat, Aug 22, 2009 at 12:00:44AM +0200, Martin Maechler wrote: I have taken up the issue now, and after thinking, studying the source, trying to define a 'method = string' argument, came to the conclusion that both the implementation and documentation (and source code self-explanation) are

Re: [Rd] user supplied random number generators

2009-08-18 Thread Petr Savicky
replying to). Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] identical(0, -0)

2009-08-12 Thread Petr Savicky
On Wed, Aug 12, 2009 at 04:02:28PM +0200, Martin Maechler wrote: PS == Petr Savicky savi...@cs.cas.cz on Wed, 12 Aug 2009 13:50:46 +0200 writes: PS Let me add the following to the discussion of identical(0, -0). PS I would like to suggest to replace the paragraph PS

Re: [Rd] identical(0, -0)

2009-08-11 Thread Petr Savicky
On Tue, Aug 11, 2009 at 10:04:20AM +0200, Martin Maechler wrote: DM == Duncan Murdoch murd...@stats.uwo.ca on Mon, 10 Aug 2009 11:51:53 -0400 writes: DM For people who want to play with these, here are some functions that let DM you get or set the payload value in a NaN.

Re: [Rd] identical(0, -0)

2009-08-10 Thread Petr Savicky
On Sat, Aug 08, 2009 at 10:39:04AM -0400, Prof. John C Nash wrote: I'll save space and not include previous messages. My 2 cents: At the very least the documentation needs a fix. If it is easy to do, then Ted Harding's suggestion of a switch (default OFF) to check for sign difference would

Re: [Rd] identical(0, -0)

2009-08-10 Thread Petr Savicky
On Mon, Aug 10, 2009 at 05:47:57AM -0400, Duncan Murdoch wrote: I wouldn't mind a strict option. It would compare bit patterns, so would distinguish +0 from -0, and different NaN values. I think that a logical option strict in the above meaning could be useful for debugging. The default may

Re: [Rd] Accuracy (PR#13867)

2009-08-04 Thread Petr Savicky
On Tue, Aug 04, 2009 at 04:25:09PM +0200, lueth...@student.ethz.ch wrote: Hi I created the following vectors: p_1=c(0.2,0.2,0.2,0.2,0.1,0.25,0.4,0.1,0.25,0.4,0.1,0.25,0.4,0.1,0.25,0.4,0.2,0.5,0.8,0.2,0.5,0.8,0.2,0.5,0.8,0.2,0.5,0.8)

Re: [Rd] incorrect result (41/10-1/10)%%1 (PR#13863)

2009-08-03 Thread Petr Savicky
I get an incorrect result for (41/10-1/10)%%1 [1] 1 Note that due to rounding errors, 41/10-1/10 is formatC(41/10-1/10, digits=20) # [1] 3.9995559 Besides FAQ 7.31, related information may be found also at http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy Petr.

Re: [Rd] factor() calls sort.list unnecessarily?

2009-07-05 Thread Petr Savicky
On Fri, Jul 03, 2009 at 07:57:49AM -0700, Martin Morgan wrote: [...] sort.list is always called but used only to determine the order of levels, so unnecessary when levels are provided. I think, this is correct. Replacing ind - sort.list(x) by if (missing(levels)) ind - sort.list(x)

Re: [Rd] read.csv

2009-06-25 Thread Petr Savicky
On Sun, Jun 14, 2009 at 02:56:01PM -0400, Gabor Grothendieck wrote: If read.csv's colClasses= argument is NOT used then read.csv accepts double quoted numerics: 1: read.csv(stdin()) 0: A,B 1: 1,1 2: 2,2 3: A B 1 1 1 2 2 2 However, if colClasses is used then it seems that it does

Re: [Rd] read.csv

2009-06-25 Thread Petr Savicky
I am sorry for not including the attachment mentioned in my previous email. Attached now. Petr. --- R-devel/src/library/utils/R/readtable.R 2009-05-18 17:53:08.0 +0200 +++ R-devel-readtable/src/library/utils/R/readtable.R 2009-06-25 10:20:06.0 +0200 @@ -143,9 +143,6 @@

Re: [Rd] read.csv

2009-06-16 Thread Petr Savicky
On Sun, Jun 14, 2009 at 09:21:24PM +0100, Ted Harding wrote: On 14-Jun-09 18:56:01, Gabor Grothendieck wrote: If read.csv's colClasses= argument is NOT used then read.csv accepts double quoted numerics: 1: read.csv(stdin()) 0: A,B 1: 1,1 2: 2,2 3: A B 1 1 1 2 2 2

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-31 Thread Petr Savicky
On Sat, May 30, 2009 at 07:32:52PM +0200, Martin Maechler wrote: vQ == Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no on Sat, 30 May 2009 11:16:43 +0200 writes: [...] vQ one simple way to improve the code is as follows; instead of (simplified) vQ const char*

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-29 Thread Petr Savicky
On Fri, May 29, 2009 at 03:53:02PM +0200, Martin Maechler wrote: my version of *using* the function was 1 SEXP attribute_hidden StringFromReal(double x, int *warn) 2 { 3 int w, d, e; 4 formatReal(x, 1, w, d, e, 0); 5 if (ISNA(x)) return NA_STRING; 6 else return

Re: [Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-28 Thread Petr Savicky
On Wed, May 27, 2009 at 10:51:38PM +0200, Martin Maechler wrote: I have very slightly modified the changes (to get rid of -Wall warnings) and also exported the function as Rf_dropTrailing0(), and tested the result with 'make check-all' . Thank you very much for considering the patch. -Wall

[Rd] inconsistency in ?factor

2009-05-25 Thread Petr Savicky
In the almost current development version (2009-05-22 r48594) and also in https://svn.r-project.org/R/trunk/src/library/base/man/factor.Rd ?factor contains (compare the formulations marked by ^^) \section{Warning}{ The interpretation of a factor depends on both the codes and the

Re: [Rd] inconsistency in ?factor

2009-05-25 Thread Petr Savicky
On Mon, May 25, 2009 at 03:58:06PM +0800, Berwin A Turlach wrote: Well, the first statement is a remark on comparison in general while the second statement is specific to comparison operators and generic methods. There are other ways of comparing objects; note: R f1 - factor(c(a, b, c, c,

[Rd] as.numeric(levels(factor(x))) may be a decreasing sequence

2009-05-23 Thread Petr Savicky
Function factor() in the current development version (2009-05-22) guarantees that levels are different character strings. However, they may represent the same decimal number. The following example is derived from a posting by Stavros Macrakis in thread Match .3 in a sequence in March nums - 0.3

Re: [Rd] qbinom (PR#13711)

2009-05-23 Thread Petr Savicky
On Wed, May 20, 2009 at 11:10:11PM +0200, wolfgang.re...@gmail.com wrote: ... Strange behavior of qbinom: qbinom(0.01, 5016279, 1e-07) [1] 0 qbinom(0.01, 5016279, 2e-07) [1] 16 qbinom(0.01, 5016279, 3e-07) [1] 16 qbinom(0.01, 5016279, 4e-07) [1] 16 qbinom(0.01, 5016279, 5e-07)

Re: [Rd] Spearman's rank correlation test (PR#13574)

2009-05-15 Thread Petr Savicky
Bug report Spearman's rank correlation test (PR#13574) was moved to trashcan with empty Notes field. I would like to learn, what was wrong with this bug report. Can i ask the developers to add a note to it? Thank you in advance. Petr. __

Re: [Rd] simple add error (PR#13699)

2009-05-14 Thread Petr Savicky
On Wed, May 13, 2009 at 02:35:12PM +0200, gos...@igmm.cnrs.fr wrote: I cannot explain why R seems to have problems adding two big numbers. sprintf(%f,10^4+10^19) gives 10010240.00 instead of 1001.00 problems seems to arrive when i'm

Re: [Rd] suggestion for extending ?as.factor

2009-05-12 Thread Petr Savicky
On Mon, May 11, 2009 at 05:06:38PM +0200, Martin Maechler wrote: The version I have committed a few hours ago is indeed a much re-simplified version, using as.character(.) explicitly The current development version (2009-05-11 r48528) contains in ?factor a description of levels parametr

Re: [Rd] suggestion for extending ?as.factor

2009-05-11 Thread Petr Savicky
On Mon, May 11, 2009 at 05:06:38PM +0200, Martin Maechler wrote: [...] The version I have committed a few hours ago is indeed a much re-simplified version, using as.character(.) explicitly and consequently no longer providing the extra optional arguments that we have had for a couple of days.

Re: [Rd] suggestion for extending ?as.factor

2009-05-10 Thread Petr Savicky
On Sat, May 09, 2009 at 10:55:17PM +0200, Martin Maechler wrote: [...] If'd revert to such a solution, we'd have to get back to Peter's point about the issue that he'd think table(.) should be more tolerant than as.character() about almost equality. For compatibility reasons, we could also

Re: [Rd] suggestion for extending ?as.factor

2009-05-08 Thread Petr Savicky
On Wed, May 06, 2009 at 10:41:58AM +0200, Martin Maechler wrote: PD I think that the real issue is that we actually do want almost-equal PD numbers to be folded together. yes, this now (revision 48469) will happen by default, using signif(x, 15) where '15' is the default for the

Re: [Rd] suggestion for extending ?as.factor

2009-05-08 Thread Petr Savicky
On Fri, May 08, 2009 at 03:18:01PM +0200, Martin Maechler wrote: As long as we don't want to allow factor(numeric) to fail --rarely -- I think (and that actually has been a recurring daunting thought for quite a few days) that we probably need an extra step of checking for duplicate levels,

Re: [Rd] suggestion for extending ?as.factor

2009-05-08 Thread Petr Savicky
On Fri, May 08, 2009 at 05:14:48PM +0200, Petr Savicky wrote: Let me suggest to consider the following modification, where match() is done on the strings, not on the original values. levels - unique(as.character(sort(unique(x x - as.character(x) f - match(x, levels) An alternative

Re: [Rd] suggestion for extending ?as.factor

2009-05-08 Thread Petr Savicky
On Fri, May 08, 2009 at 06:48:40PM +0200, Martin Maechler wrote: PS == Petr Savicky savi...@cs.cas.cz on Fri, 8 May 2009 18:10:56 +0200 writes: [...] PS ... I have PS strong objections against the existing implementation of as.character(), {(because it is not *accurate

Re: [Rd] suggestion for extending ?as.factor

2009-05-07 Thread Petr Savicky
On Wed, May 06, 2009 at 10:41:58AM +0200, Martin Maechler wrote: PD I think that the real issue is that we actually do want almost-equal PD numbers to be folded together. yes, this now (revision 48469) will happen by default, using signif(x, 15) where '15' is the default for the

Re: [Rd] suggestion for extending ?as.factor

2009-05-05 Thread Petr Savicky
On Mon, May 04, 2009 at 07:28:06PM +0200, Peter Dalgaard wrote: Petr Savicky wrote: For this, we get convert(0.3) [1] 0.3 convert(1/3) [1] 0. # 16 digits suffice convert(0.12345) [1] 0.12345 convert(0.12345678901234567) [1

Re: [Rd] suggestion for extending ?as.factor

2009-05-05 Thread Petr Savicky
On Tue, May 05, 2009 at 11:27:36AM +0200, Peter Dalgaard wrote: I know. The point was rather that if you are not careful with rounding, you get the some of the bars wrong (you get 2 or 3 small bars very close to each other instead of one longer one). Computed p values from permutation tests

Re: [Rd] suggestion for extending ?as.factor

2009-05-04 Thread Petr Savicky
On Mon, May 04, 2009 at 05:39:52PM +0200, Martin Maechler wrote: [snip] Let me quickly expand the tasks we have wanted to address, when I started changing factor() for R-devel. 1) R-core had unanimously decided that R 2.10.0 should not allow duplicated levels in factors anymore. When

Re: [Rd] 'is.integer' (PR#13671)

2009-04-23 Thread Petr Savicky
On Wed, Apr 22, 2009 at 04:30:36PM -0400, Stavros Macrakis wrote: [snip] Now consider 1e40, which has the property that floor(x)==x==ceiling(x), which you might think characterizes an integer; but it also has the property that x+1 == x. Similarly for 1/3 * 1e40. [snip] The number 1/3 * 1e40

Re: [Rd] 'is.integer' (PR#13671)

2009-04-23 Thread Petr Savicky
On Thu, Apr 23, 2009 at 11:37:37AM +0200, Martin Maechler wrote: [snip] TP To test whether a value is an integer value, you can so something like this: is.wholenumber - function(x, tolerance = .Machine$double.eps^0.5) TP return(abs(x - round(x)) tolerance)

Re: [Rd] Error in FrF2 example on Mac OS

2009-03-25 Thread Petr Savicky
On Tue, Mar 24, 2009 at 07:41:31AM -0700, Ulrike Grömping wrote: Probably, k is needed also later. Assumig that 2^k works correctly, the following could be sufficient if (!is.null(nruns)){ k - round(log2(nruns)) if (!2^k==nruns) stop(nruns must be a power of 2.)}

Re: [Rd] Error in FrF2 example on Mac OS

2009-03-24 Thread Petr Savicky
On Tue, Mar 24, 2009 at 02:45:57PM +0100, Uwe Ligges wrote: gives the custom error message nruns must be a power of 2., which is generated in the first check within function FrF2: if (!is.null(nruns)){ k - floor(log2(nruns)) if (!2^k==nruns) stop(nruns must be a power of

Re: [Rd] Match .3 in a sequence

2009-03-17 Thread Petr Savicky
On Mon, Mar 16, 2009 at 07:39:23PM -0400, Stavros Macrakis wrote: ... Let's look at the extraordinarily poor behavior I was mentioning. Consider: nums - (.3 + 2e-16 * c(-2,-1,1,2)); nums [1] 0.3 0.3 0.3 0.3 Though they all print as .3 with the default precision (which is normal and

Re: [Rd] Match .3 in a sequence

2009-03-17 Thread Petr Savicky
On Tue, Mar 17, 2009 at 10:15:39AM +0100, Wacek Kusnierczyk wrote: ... there's one more curiosity about factors, in particular, ordered factors: ord - as.ordered(nums); ord # [1] 0.300 0.3 0.3 0.300 # Levels: 0.300

Re: [Rd] Match .3 in a sequence

2009-03-17 Thread Petr Savicky
On Tue, Mar 17, 2009 at 10:04:39AM -0400, Stavros Macrakis wrote: ... 1) Factor allows repeated levels, e.g. factor(c(1),c(1,1,1)), with no warning or error. Yes, this is a confusing behavior, since repeated levels are never meaningful. 2) Even from distinct inputs, factor of a numeric vector

Re: [Rd] Match .3 in a sequence

2009-03-16 Thread Petr Savicky
On Mon, Mar 16, 2009 at 06:36:53AM -0700, Daniel Murphy wrote: Hello:I am trying to match the value 0.3 in the sequence seq(.2,.3). I get 0.3 %in% seq(from=.2,to=.3) [1] FALSE As others already pointed out, you should use seq(from=0.2,to=0.3,by=0.1) to get 0.3 in the sequence. In order to get

[Rd] Spearman's rank correlation test (PR#13574)

2009-03-05 Thread savicky
Full_Name: Petr Savicky Version: 2.7.2, 2.8.1, 2.9.0 OS: Linux Submission from: (NULL) (147.231.6.9) The p-value of Spearman's rank correlation test is calculated in cor.test(x, y, method=spearman) using algorithm AS 89. However, the way how AS 89 is used incures error, which may be an order

Re: [Rd] invalid comparison in numeric sequence (PR#13551)

2009-02-25 Thread Petr Savicky
seq(0,1,0.1)==0.4 [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE seq(0,1,0.1)==0.6 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE seq(0,1,0.1)==0.8 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE What is wrong with

[Rd] Spearman's rank correlation test

2009-02-12 Thread Petr Savicky
Hi All: help(cor.test) claims For Spearman's test, p-values are computed using algorithm AS 89. Algorithm AS 89 was introduced by the paper D. J. Best D. E. Roberts (1975), Algorithm AS 89: The Upper Tail Probabilities of Spearman's rho. Applied Statistics, Vol. 24, No. 3, 377-379. Table

Re: [Rd] bug in cor.test(method = spearman)

2009-01-26 Thread Petr Savicky
Hi All: The p-value of Spearman's rank correlation test is calculated using algorithm AS 89. However, the way how AS 89 is used incures error, which may be an order of magnitude larger than the error of the original algorithm. In case of no ties AS 89 expects an even value of the statistic S =

[Rd] bug in cor.test(method = spearman)

2009-01-17 Thread savicky
Dear R developers: There is a possible bug in calculating the p-value for Spearman's rank correlation. Line 155 in file R-patched/src/library/stats/R/cor.test.R is as.double(round(q) + lower.tail), I think, it should be as.double(round(q) + 2*lower.tail), The reason is that round(q)

[Rd] bug in detection of zero state for Mersenne Twister (PR#10362)

2007-10-22 Thread savicky
Full_Name: Petr Savicky Version: all versions starting from 1.7.0 OS: observed on Linux, but is platform independent Submission from: (NULL) (62.24.91.47) The function runif(n) contains a protection against the zero state of Mersenne Twister stored in .Random.seed. If the state is zero

[Rd] predictable bit patterns in runif(n) shortly after set.seed

2007-10-17 Thread Petr Savicky
could be considered. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] all zeroes in Mersenne Twister state may remain undetected

2007-10-15 Thread Petr Savicky
= 2; j = 624; j++) if(RNG_Table[RNG_kind].i_seed[j] != 0) { notallzero = 1; break; Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] as.integer(x) versus as.integer(trunc(x))

2007-10-12 Thread Petr Savicky
2147483646 2147483646 [4,] 2147483646.5 2147483646 2147483646 [5,] 2147483647.0 2147483647 2147483647 [6,] 2147483647.5 2147483647 2147483647 [7,] 2147483648.0 NA NA Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch

Re: [Rd] modifying large R objects in place

2007-09-29 Thread Petr Savicky
by a different function, not the default gc() itself. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] modifying large R objects in place

2007-09-28 Thread Petr Savicky
or not. Structures, for which this succeeds are then removed. Am I right? If yes, is it possible during gc() to determine also cases, when NAMED may be dropped from 2 to 1? How much would this increase the complexity of gc()? Thank you in advance for your kind reply. Petr Savicky

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
- matrix(as.integer(1),nrow=5,ncol=3) + as.integer(0) .Call(getnamed,u) # 1 (OK) ncol(u) .Call(getnamed,u) # 2 (so, ncol does the same) Is this a bug? Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
, the object duplicates, but nothing more. The main part of my previous email (question concerning a possible bug in the behavior of nrow(a) and ncol(a)) remains open. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [Rd] modifying large R objects in place

2007-09-27 Thread Petr Savicky
:6) dim(a,a) # Error: 2 arguments passed to 'dim' which requires 1 May be, also other solutions exist. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] modifying large R objects in place

2007-09-26 Thread Petr Savicky
is not 0. I appreciate, if anybody could give me advice on the above things. Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] initial scrambling of seed in do_setseed / RNG_Init

2007-09-23 Thread Petr Savicky
the initial scrambling in user_unif_init, use seed = 3602842457U * (seed - 2358491998U); Petr Savicky. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] When 1+2 != 3 (PR#9895)

2007-09-03 Thread Petr Savicky
Savicky. If it may be usefull, I have written to small function (Unique and isEqual) which can deal with this problem of the double numbers. I also add some other conditions for the same problem. 0.3 == 0.15 + 0.15 0.3 == 0.1 + 0.2 1 - 0.7 == 0.3 0.1 == 1 - 0.9 0.2

  1   2   >