Re: [Rd] pbirthday() for larger number of classes

2020-05-22 Thread Marius Hofert
... and one should include the pigeonhole principle: pbirthday2 <- function(n, classes = 365) { c <- classes # as pbirthday() if(n >= 2) { if(n > classes) 1 else -expm1(sum(log1p(-(1:(n-1))/classes))) } else 0 } __ R-devel@r-project.

[Rd] pbirthday() for larger number of classes

2020-05-22 Thread Marius Hofert
Hi, pbirthday(, coincident = 2) starts to issue warnings (see (*) below) for larger number of classes (R 4.0.0, R-devel ./src/library/stats/R/birthday.R:47). The default coincident = 2 is computed as 1 - prod((c:(c - n + 1))/rep(c, n)) where c = classes. Using exp(log(...)), one can derive the re

[Rd] Expressions from boxplot() passed to bxp()

2020-03-26 Thread Marius Hofert
Hi, Is this expected behavior (R-3.6.0)? dat <- cbind(x = 1:10, y = 10:1) ylab <- substitute(X[t], list(t = 2)) plot(dat, ylab = ylab) # works (correctly displays ylab) boxplot(dat, ylab = ylab) # fails boxplot(dat, ylab = as.expression(ylab)) # works Thanks & cheers, M

[Rd] extendrange(): suggested improvement

2018-04-25 Thread Marius Hofert
Hi, I often need to extend the plot range to the right, but not to the left (for example: not below 0 so that log = "x" still works...). This could be a handy improvement of extendrange(): --- utils.R 2015-08-25 18:18:20.0 -0400 +++ utils.R 2018-04-25 17:21:25.0 -0400 @@ -30,6 +30

Re: [Rd] R process killed when allocating too large matrix (Mac OS X)

2016-05-04 Thread Marius Hofert
Hi Simon, ... all interesting (but quite a bit above my head). I only read 'Linux' and want to throw in that this problem does not appear on Linux (it seems). I talked about this with Martin Maechler and he reported that the same example (on one of his machines; with NA_real_ instead of '0's in th

Re: [Rd] R process killed when allocating too large matrix (Mac OS X)

2016-05-04 Thread Marius Hofert
e large. Be aware of killers in your neighborhood"... before the killer attacks. Thanks & cheers, Marius On Wed, May 4, 2016 at 8:54 PM, Simon Urbanek wrote: > > On May 4, 2016, at 6:14 PM, Marius Hofert wrote: > >>> Can you elaborate on "leads to R being killed&quo

Re: [Rd] R process killed when allocating too large matrix (Mac OS X)

2016-05-04 Thread Marius Hofert
> Can you elaborate on "leads to R being killed"? You should tell to the killer > not to do it again :). Hi Simon! Sure, but who do you tell it if you don't know the killer? This is all the killer left me with, the 'crime scene' if you like :-) > m <- matrix(0, 9, 10) Killed: 9 My coll

[Rd] R process killed when allocating too large matrix (Mac OS X)

2016-05-03 Thread Marius Hofert
Dear expeRts, The following code leads to R being killed (under Mac OS X 10.11.4; R installed from source; also happened under a previous unstable version): m <- matrix(0, 10, 10) I expected an error that a vector of this size could not be allocated. Besides the above (a bug?), how can

Re: [Rd] R CMD BATCH vs R CMD batch

2015-10-28 Thread Marius Hofert
Great, thanks, Dirk. Nice example :-) On Wed, Oct 28, 2015 at 10:05 PM, Dirk Eddelbuettel wrote: > > On 28 October 2015 at 21:39, Marius Hofert wrote: > | Out of laziness I just used "R CMD batch" instead of "R CMD BATCH". I > | didn't get an error so didn&

[Rd] R CMD BATCH vs R CMD batch

2015-10-28 Thread Marius Hofert
Hi, Out of laziness I just used "R CMD batch" instead of "R CMD BATCH". I didn't get an error so didn't think about the consequences... One consequence is (at least on Mac OS X 10.11 but probably in more generality) that R_BATCH_OPTIONS are ignored, which was kind of fatal in my case... I am thus

Re: [Rd] rank(, ties.method="last")

2015-10-20 Thread Marius Hofert
On Tue, Oct 20, 2015 at 10:26 AM, Henric Winell wrote: > Den 2015-10-09 kl. 12:14, skrev Martin Maechler: > I think so: the code above doesn't seem to do the right thing. Consider > the following example: > > > x <- c(1, 1, 2, 3) > > rank2(x, ties.method = "last") > [1] 1 2 4 3 > > That doesn't

[Rd] Improvement of R_orderVector() via orderVector1()

2015-10-09 Thread Marius Hofert
Hi, I think R_orderVector() can be improved by calling orderVector1() if possible. In a problem we had, this gave us a run time improvement factor of 4 so my hope is that this can be included. Below is the suggested change, I'm just not 100% sure if the test "CDR(arglist) == R_NilValue" is goo

[Rd] rank(, ties.method="last")

2015-10-08 Thread Marius Hofert
Hi, I ran into a problem where I actually need rank(, ties.method="last"). It would be great to have this feature in base and it's also simple to get (see below). Thanks & cheers, Marius rank2 <- function (x, na.last = TRUE, ties.method = c("average", "first", "last", # new "last" "random",

Re: [Rd] Seed in 'parallel' vignette

2015-03-08 Thread Marius Hofert
On Tue, Feb 3, 2015 at 10:39 AM, Marius Hofert wrote: > Hi, > > This is most likely only a minor technicality, but I saw the > following: On page 6 of the 'parallel' vignette > (http://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf), > the random-num

[Rd] Seed in 'parallel' vignette

2015-02-03 Thread Marius Hofert
s by the modulus of the first linear congruential generator + 1] 2) The case z_n=0 is not provided (for a reason?). If z_n=0, L'Ecuyer suggests to set u_n to "(2^32-209)/(2^32-208)". Cheers, Marius -- Marius Hofert, Dr. rer. nat. Assistant Professor Department of Statistics and

Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-23 Thread Marius Hofert
cessing units and 'cat /proc/cpuinfo | grep processor | wc -l' will > also give the number of installed processing units. both commands give me '4'. > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Fri, Aug 22, 2014 at 3:17 PM, Marius Hofert >

Re: [Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Marius Hofert
ill see the offending shell command. > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Fri, Aug 22, 2014 at 1:03 PM, Marius Hofert > wrote: >> Hi, >> >> Both under the current R-devel (r66456) and a version from about 3 >> months ago, I experience the

[Rd] parallel::detectCores(TRUE) gives: Error in system(cmd, TRUE) : error in running command

2014-08-22 Thread Marius Hofert
Hi, Both under the current R-devel (r66456) and a version from about 3 months ago, I experience the following behavior: > parallel::detectCores(TRUE) Error in system(cmd, TRUE) : error in running command > traceback() 3: system(cmd, TRUE) 2: gsub("^ +", "", system(cmd, TRUE)[1]) 1: parallel::dete

[Rd] Patch for format.ftable()

2013-03-05 Thread Marius Hofert
) format.ftable.(ft4, method="compact") format.ftable.(ft5) format.ftable.(ft5, method="row.compact") format.ftable.(ft5, method="col.compact") format.ftable.(ft5, method="compact") --8<---cut here---end--->8--- -- ETH Zurich D

Re: [Rd] Length of seed for l'Ecuyer-CMRG

2013-01-22 Thread Marius Hofert
I'm sorry, I must have overlooked the "... as given by .Random.seed". Thanks for helping. Marius __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Length of seed for l'Ecuyer-CMRG

2013-01-22 Thread Marius Hofert
Dear expeRts, ./src/library/base/man/Random.Rd says that L'Ecuyer requires a seed of length 6. ./src/library/parallel/man/RngStream.Rd also mentions this, but only in the text part; In the "Arguments"-part, it says that "seed" has to be of length 7 Also: , | > RNGkind("L'Ecuyer-CMRG") | > l

Re: [Rd] weird bug with parallel, RSQlite and tcltk

2012-12-31 Thread Marius Hofert
Dear Karl, I get exactly the same warning messages with an Rmpi minimal example (also took me a while to narrow it down). I posted it on R-sig-hpc (more appropriate for these issues I believe), some days ago, but haven't received an answer yet. Cheers, Marius PS: https://stat.ethz.ch/pipermail/

[Rd] Suggestion: 'method' slot for expand.grid() (incl. diffs)

2012-12-27 Thread Marius Hofert
Dear expeRts, The order in which the variables vary in expand.grid() is often unintuitive. I would like to suggest a 'method' slot for expand.grid() which requires only very little changes (100% backward compatible) and which allows one to control this order. Please find attached diffs against R-d

Re: [Rd] Suggestion: 'method' slot for format.ftable()

2012-12-22 Thread Marius Hofert
Dear Martin, Thanks a lot, that sounds great. Here is the unified diff for ?read.ftable.Rd. Cheers, Marius --- /home/mhofert/R/R-devel/src/library/stats/man/read.ftable.Rd 2012-12-21 02:09:18.488980586 +0100 +++ read.ftable.Rd 2012-12-22 21:45:08.574636009 +0100 @@ -14,9 +14,13 @@

[Rd] Suggestion: 'method' slot for format.ftable()

2012-12-17 Thread Marius Hofert
act") format.ftable(ft, quote=FALSE, method="compact") ## Titanic data set ft. <- ftable(Titanic, row.vars=1:2, col.vars=3:4) format.ftable(ft., quote=FALSE) format.ftable(ft., quote=FALSE, method="row.compact") format.ftable(ft., quote=FALSE, method="col.co