Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2016-01-05 Thread Josh O'Brien
On Tue, Jan 5, 2016 at 1:31 AM, Martin Maechler wrote: >> Josh O'Brien >> on Mon, 4 Jan 2016 16:16:51 -0800 writes: > > > On Dec 19, 2015, at 3:32 AM, Martin Maechler stat.math.ethz.ch> wrote: > > >>> Martin Maechler on > >>> Sat, 12 Dec 2015 10:32:51 +0100 w

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2016-01-05 Thread Martin Maechler
> Josh O'Brien > on Mon, 4 Jan 2016 16:16:51 -0800 writes: > On Dec 19, 2015, at 3:32 AM, Martin Maechler wrote: >>> Martin Maechler on >>> Sat, 12 Dec 2015 10:32:51 +0100 writes: >> >>> John Chambers on Fri, 11 Dec >>> 2015 10:11:05 -0800

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2016-01-04 Thread Josh O'Brien
On Dec 19, 2015, at 3:32 AM, Martin Maechler wrote: >> Martin Maechler >>on Sat, 12 Dec 2015 10:32:51 +0100 writes: > >> John Chambers >>on Fri, 11 Dec 2015 10:11:05 -0800 writes: > >>> Somehow, the most obvious fixes are always back-incompatible these days. >>> The exam

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-19 Thread John Chambers
As I tried to say on Dec. 11, there are two levels of "fix": 1. The fix to the complaint in the OP's subject heading is to conform to the default third argument, strict=TRUE: as(1L, "numeric") == 1.0 This generates some incompatibilities, as for classes that extend "numeric". But still leaves

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-19 Thread Martin Maechler
> Martin Maechler > on Sat, 12 Dec 2015 10:32:51 +0100 writes: > John Chambers > on Fri, 11 Dec 2015 10:11:05 -0800 writes: >> Somehow, the most obvious fixes are always back-incompatible these days. >> The example intrigued me, so I looked into it a bit (should

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-12 Thread Martin Maechler
> John Chambers > on Fri, 11 Dec 2015 10:11:05 -0800 writes: > Somehow, the most obvious fixes are always back-incompatible these days. > The example intrigued me, so I looked into it a bit (should have been doing something else, but ) > You're right that this is the

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-11 Thread Morgan, Martin
thz.ch] Sent: Friday, December 11, 2015 4:25 AM To: John Chambers; r-devel@r-project.org; bioc-devel list; Benjamin Tyner Cc: Martin Maechler Subject: Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect. >>>>> Martin Maechler >>>>> on Tue,

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-11 Thread John Chambers
Somehow, the most obvious fixes are always back-incompatible these days. The example intrigued me, so I looked into it a bit (should have been doing something else, but ) You're right that this is the proverbial thin-edge-of-the-wedge. The problem is in setDataPart(), which will be called w

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-11 Thread Martin Maechler
> Martin Maechler > on Tue, 8 Dec 2015 15:25:21 +0100 writes: > John Chambers > on Mon, 7 Dec 2015 16:05:59 -0800 writes: >> We do need an explicit method here, I think. >> The issue is that as() uses methods for the generic function coerce() but cannot use inhe

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-08 Thread Martin Maechler
> John Chambers > on Mon, 7 Dec 2015 16:05:59 -0800 writes: > We do need an explicit method here, I think. > The issue is that as() uses methods for the generic function coerce() but cannot use inheritance in the usual way (if it did, you would be immediately back with no ch

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-07 Thread John Chambers
We do need an explicit method here, I think. The issue is that as() uses methods for the generic function coerce() but cannot use inheritance in the usual way (if it did, you would be immediately back with no change, since "integer" inherits from "numeric"). Copying in the general method for co

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-07 Thread Benjamin Tyner
Perhaps it is not that surprising, given that > mode(1L) [1] "numeric" and > is.numeric(1L) [1] TRUE On the other hand, this is curious, to say the least: > is.double(as(1L, "double")) [1] FALSE Here's the surprising behavior: x <- 1L xx <- as(x, "numeric")

[Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-04 Thread Josh O'Brien
Here's the surprising behavior: x <- 1L xx <- as(x, "numeric") class(xx) ## [1] "integer" It occurs because the call to `as(x, "numeric")` dispatches the coerce S4 method for the signature `c("integer", "numeric")`, whose body is copied in below. function (from, to = "numeric", s