[R] setClass with a slot of RODBC
David James
daj025 at gmail.com
Sat Jun 2 16:32:47 CEST 2007
Hi,
A couple of thoughts:
(1) The channel RODBC is an S3 object, thus there's no proper S4 class
associated with it. From ?setOldClass:
....
Description:
Register an old-style (a.k.a. `S3') class as a formally defined
class. The 'Classes' argument is the character vector used as the
'class' attribute; in particular, if there is more than one
string, old-style class inheritance is mimicked. Registering via
'setOldClass' allows S3 classes to appear in method signatures,
and as a slot in an S4 class if a prototype is included.
...
(2) This question may be more appropriate for r-devel?
HTH,
--
David
On 6/1/07, adschai at optonline.net <adschai at optonline.net> wrote:
> Hi - I tried to get some answer before but there seems to have no one response. My question is that I have a class like below definition:
>
> setClass("DBManager",
> representation(channel="RODBC"))
>
> My purpose of the conn slot is to hold a channel to database connection which is returned by a command like:
>
> channel <- odbcConnect("DB", uid="user", pwd="password")
>
> According to RODBC documentation, this channel is supposed to have a type of "RODBC". However, if I declare my class as above, R will complain that it does not know about "RODBC" type or class. Please clarify. Thank you.
>
> - adschai
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list