Re: [Rd] x[c()] <- value sets the mode to mode(value)

2009-12-08 Thread William Dunlap
> -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Henrik Bengtsson > Sent: Tuesday, December 08, 2009 5:45 PM > To: R-devel > Subject: [Rd] x[c()] <- value sets the mode to mode(value) > > Only for the record, > > an unnecess

[Rd] x[c()] <- value sets the mode to mode(value)

2009-12-08 Thread Henrik Bengtsson
Only for the record, an unnecessary overhead when nothing is assigned: > x <- integer(10) > str(x) int [1:10] 0 0 0 0 0 0 0 0 0 0 > x[c()] <- 1.0; > str(x) num [1:10] 0 0 0 0 0 0 0 0 0 0 'x' could equally well have renamed untouched. /Henrik __ R-d

[Rd] lty parameter not respected by pdf device

2009-12-08 Thread baptiste auguie
Dear all, Several of us ggplot2 users noticed the disappearance of some dashed lines in the pdf output produced with the pdf device. They looked fine on screen or with quartz() output. When opening the file with Illustrator I noted that the missing line was in fact present, but with a dashed patte

Re: [Rd] extraction of sub-matrix by name

2009-12-08 Thread Tony Plate
This is documented behavior. From ?"[.data.frame": Both ‘[’ and ‘[[’ extraction methods partially match row names. By default neither partially match column names, but ‘[[’ will unless ‘exact=TRUE’. If you want to do exact matching on row names use ‘match’ as in the examples. In the history of S

[Rd] extraction of sub-matrix by name

2009-12-08 Thread Yurii Aulchenko
Dear all, sorry to bother you with potentially known issue -- we have noticed that if we select data frame rows by rownames, we get some results back if the match can be done unambiguously, though the match is not perfect (see example), e.g. x{"2",] will return a row if there is a unique r

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread William Dunlap
A more direct way to reproduce this is > pbinom(q=0:4, size=4, prob=.25, lower.tail=FALSE) [1] 0.68359375 0.26171875 0.05078125 0.00390625 0. > pbinom(q=0:4, size=4, prob=.25, lower.tail=c(FALSE,TRUE,TRUE,TRUE)) [1] 0.68359375 0.26171875 0.05078125 0.00390625 0. > pbinom(q

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ravi Varadhan
They will not be the same. The problem is that the `lower.tail' argument is not vectorized. Therefore, it is always set equal to the first element of `Resp', which in your example is FALSE. If you want to obtain same results, this will do the trick: ans1 <- ifelse(Resp, log(pnorm(Xb)), log(1

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ken Knoblauch
Thank you. That explains it. I didn't read closely enough. best, Ken Quoting Prof Brian Ripley : From the help page: pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) x,q: vector of quantiles. lower.tail: logical; if TRUE (default), probabilities are P[X <= x],

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Ben Bolker
Ken Knoblauch inserm.fr> writes: > > Hi, > > I would have thought that these two constructions would > produce the same result but they do not. > > Resp <- rbinom(10, 1, 0.5) > Stim <- rep(0:1, 5) > mm <- model.matrix(~ Stim) > Xb <- mm %*% c(0, 1) > ifelse(Resp, log(pnorm(Xb)), log(1 - pnorm(

Re: [Rd] lower.tail option in pnorm

2009-12-08 Thread Prof Brian Ripley
From the help page: pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) x,q: vector of quantiles. lower.tail: logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. Note that lower.tail is not said to be a vector, and the first value is tak

[Rd] lower.tail option in pnorm

2009-12-08 Thread Ken Knoblauch
Hi, I would have thought that these two constructions would produce the same result but they do not. Resp <- rbinom(10, 1, 0.5) Stim <- rep(0:1, 5) mm <- model.matrix(~ Stim) Xb <- mm %*% c(0, 1) ifelse(Resp, log(pnorm(Xb)), log(1 - pnorm(Xb))) pnorm(as.vector(Xb), lower.tail = Resp, log.p = TRU

Re: [Rd] Crash with Unicode and sub (PR#14114)

2009-12-08 Thread maechler
> "PD" == Peter Dalgaard > on Tue, 08 Dec 2009 11:24:50 +0100 writes: PD> g.russ...@eos-solutions.com wrote: >> Full_Name: George Russell >> Version: 2.10.0 >> OS: Windows XP Version 2002 SP 2 >> Submission from: (NULL) (217.111.3.131) >> >> >> The fo

Re: [Rd] Crash with Unicode and sub (PR#14114)

2009-12-08 Thread Peter Dalgaard
g.russ...@eos-solutions.com wrote: > Full_Name: George Russell > Version: 2.10.0 > OS: Windows XP Version 2002 SP 2 > Submission from: (NULL) (217.111.3.131) > > > The following typed into R --vanilla induces a crash: > -- cut here -- > gctorture() > u <- intToUtf8(c(rep(1e3,1e2),32,c(rep(1e3,1e2