Re: [Rd] S4 coercion

2008-12-11 Thread Michael Lawrence
Hi, I am having a similar issue as reported by Paul, but I don't think Martin's example is precisely representative of the problem. Consider a hierarchy A <- B <- C: > setClass("A") [1] "A" > setClass("B", contains="A") [1] "B" > setClass("C", contains="B") [1] "C" Now define a coerce method:

Re: [Rd] S4 coercion responsibility

2008-09-17 Thread Seth Falcon
Continuing to talk to myself here... * On 2008-09-17 at 21:06 -0700 Seth Falcon wrote: > *argh* I'm certain this was working for me and yet when I try to > reproduce in a new R shell it errors out. This looks like an infelicity in the methods caching. To make it work: library("RSQLite")

Re: [Rd] S4 coercion responsibility

2008-09-17 Thread Seth Falcon
* On 2008-09-17 at 19:25 -0700 Seth Falcon wrote: > In the latest R-devel code (svn r46542), this behaves differently (and > works as you were hoping). I get: > > library("RSQLite") > setClass("SQLConPlus", contains=c("SQLiteConnection","integer")) > dd = data.frame(a=1:3, b=letters[1

Re: [Rd] S4 coercion responsibility

2008-09-17 Thread Seth Falcon
A couple more comments... * On 2008-09-15 at 10:07 -0700 Seth Falcon wrote: > > The example is with RSQLite but the same thing happens with > > RMySQL, and other DBI packages. The use of as() within the various DBI packages should be re-evaluated. I suspect some of that code was among the first

Re: [Rd] S4 coercion responsibility

2008-09-15 Thread Seth Falcon
* On 2008-09-15 at 08:56 -0400 Paul Gilbert wrote: > Should functions or the user be responsible for coercing an S4 object > argument containing the proper object (and thus should below be > considered a bug in the packages or not)? > > The example is with RSQLite but the same thing happens with

[Rd] S4 coercion responsibility

2008-09-15 Thread Paul Gilbert
Should functions or the user be responsible for coercing an S4 object argument containing the proper object (and thus should below be considered a bug in the packages or not)? The example is with RSQLite but the same thing happens with RMySQL, and other DBI packages. > library("RSQLite") L

Re: [Rd] S4 coercion

2008-08-27 Thread Martin Morgan
Hi Paul -- does this make the problem more explicit? > ## class hierarchy > setClass("A", representation=representation(a="numeric")) [1] "A" > setClass("B", representation=representation(b="numeric")) [1] "B" > setClass("C", contains=c("A", "B")) [1] "C" > ## coerce methods -- in some instances

[Rd] S4 coercion

2008-08-27 Thread Paul Gilbert
I am extending a DBI connection by setClass("TSPostgreSQLConnection", contains=c("PostgreSQLConnection","TSdbOptions")) but the first time I use this I am getting a warning when it tries to coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the first use the warning stops,