Displaying 20 results from an estimated 11000 matches similar to: "Some extensions to class inheritance and method selection"
2009 Jan 27
2
Inherited Methods in r-devel (for package maintainers mainly)
A recently committed revison of R-devel (47740) has introduced a new
mechanism for ordering superclasses consistently, with related changes
for selecting inherited methods.
As part of the process, a function testInheritedMethods has been
introduced that examines method selection for the relevant subclasses
and reports ambiguities.
Maintainers of packages that have methods involving multiple
2005 May 23
2
Documentation of S3 and S4 classes, inheritance
I'd like to have a class A that computes a likelihood, and a subclass B
that computes the same likelihood by sometimes throws in an additional
term (B includes measurement error).
So B's likelihood needs to call A's, and then (sometimes) multiply by an
additional term.
It sounds as if, in the S3 scheme, NextMethod is supposed to do this:
like.A <- function(stuff) compute value
2006 Feb 10
8
Prototype Inheritance example
Hello Everyone,
I am working on a control collection for javascript/Ajax.Net. I am stuck on
the class inheritance aspects of the prototype library. If someone could
point me to an example it would be a great help. I have looked through the
controls.js of the scriptaculous library and found something like the below
code, but everytime I ran it I would get a constructor error.
Thanks for any help;
2007 Jun 04
2
locked environment and inheritance
Hi,
I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create
a S4 class which extends (adds 2 slots) another S4 class from some other package. The class
should be created in "myPkg" environment (and not global environment).
Using:
setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2009 Jul 20
1
S4 method dispatch with inheritance
Hi,
I'm trying to create a new S4 class (myMatrix) which for now just
extends dgCMatrix (from package Matrix). Then I want to use "[" which is
defined in Matrix.
Out of the box with "[" (defined in Matrix) I lose the class information
and the result is an object of class dgCMatrix. If I specify a
"["-method for myMatrix, it is not used because a signature
2015 May 28
3
S4 inheritance and old class
Hey everyone,
I would like to develop a package using S4 classes.
I have to define several S4 classes that inherits from each others as
follow:
# A <- B <- C <- D
I also would like to define .DollarNames methods for these class so, if I
have understood well, I also have to define an old class as follow:
# AOld <- A <- B <- C <- D
setOldClass(Classes = "AOld")
2019 Nov 01
3
R C api for 'inherits' S3 and S4 objects
Dear R developers,
Motivated by discussion about checking inheritance of S3 and S4
objects (in head matrix/array topic) I would light to shed some light
on a minor gap about that matter in R C API.
Currently we are able to check inheritance for S3 class objects from C
in a robust way (no allocation, thread safe). This is unfortunately
not possible for S4 classes. I would kindly request new
2019 Nov 01
4
[External] R C api for 'inherits' S3 and S4 objects
Thank you Luke.
That is why I don't use Rf_inherits but INHERITS which does not
allocate, provided in the email body.
I cannot do similarly for S4 classes, thus asking for some API for that.
On Fri, Nov 1, 2019 at 5:56 PM Tierney, Luke <luke-tierney at uiowa.edu> wrote:
>
> On Fri, 1 Nov 2019, Jan Gorecki wrote:
>
> > Dear R developers,
> >
> > Motivated by
2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
Hi,
(sorry for the wall of text; the issue here appears to be rather complicated)
I'm seeing a somewhat strange case where checking whether an S4 object
inherits from a parent class defined from another package with
'inherits' fails if that object is materialized through a call to
'load'. That's a mouthful, so I've put together a relatively small
reproducible example
2017 Aug 08
0
Inheritance for S3 classes
You might find http://adv-r.hadley.nz/s3.html to be helpful (in
particular, http://adv-r.hadley.nz/s3.html#constructors-1, gives my
advice about subclass constructors)
Hadley
On Mon, Aug 7, 2017 at 7:06 PM, Kym Nitschke <kym.nitschke at icloud.com> wrote:
> Hi R Users,
>
> I am relatively new to programming in R ? so I apologise if my questions appear ?dumb?.
>
> I am using
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
I should add one more item that may be related here -- calling
'methods:::.requirePackage' returns a different result based on
whether the package namespace is already loaded or not.
If the package namespace is not loaded, the package is loaded and
attached, and the package environment is returned:
> methods:::.requirePackage("digest")
Loading required package:
2010 Jan 11
1
Problem with S4 generic function print
First, if I have an S4 class boo should I define S3 method for
printing print.boo(..) or should I define S4 method print(..).
I mainly need to define print function only because some user might
call it and then I would like to dispatch the call to
right function instead.
Second, it seems that by defining S4 generic function print, it is
possible to break argument hinting on the status bar.
2017 Aug 08
0
Inheritance for S3 classes
The S3 class model isn't really a class model. It's more a way of
overloading functions. So it's rather simple, and there's less there
than you might be expecting. I always thought the "Object Oriented
Programming" chapter of the R language definition manual that ships
with R was a very good treatment. Have you tried there? If not, please
do so.
But surely you know how
2010 Apr 24
3
S4 Inheritance of environments
I looked through the documentation and the mailing lists and could not
find an answer to this. My apologies if it has already been answered.
If it has, a pointer to the relevant discussion would be greatly
appreciated.
Creating S4 classes containing environments exhibits unexpected
behavior/features.? These have a different in two ways:
1) slotName for the data: ".xData" instead of
2017 Aug 08
4
Inheritance for S3 classes
Hi R Users,
I am relatively new to programming in R ? so I apologise if my questions appear ?dumb?.
I am using a package that defines a number of S3 classes. I want to create an S3 child class of one of these classes. The parent class has a contractor with many arguments. I have been having difficulty writing the child class contractor. I have been unable to find a good reference in the internet
2010 Jun 13
1
S4 classes and S3 generic functions
A general goal for the next version of R is to make S4 and S3 play
better together.
As mentioned in a previous thread, one limitation has been that S3
generic functions, specifically the UseMethod() call, did not make use
of S4 inheritance when dispatching on general S4 objects.
This has been fixed in a version committed today (updated to rev 52267).
The code change is not large, but it
2016 Jul 31
2
strange behavior in 'inherits' check for loaded S4 object
(Just returning from the "wilds" of Canada, so not able to comment on the specifics, but ...)
There is a basic point about generic functions that may be related to the "private" class question and my earlier remarks that Martin alluded to.
R (and S4 before it) allows packages to define methods for a generic function in another package. Say, for plot() in graphics.
The
2008 Jan 05
3
is(x, "parent") returns FALSE when class(x) is c("child", "parent") (PR#10549)
is() does not catch parent S3 classes:
> library(splines)
> temp <- bs(1:99, df=5)
> class(temp)
[1] "bs" "basis"
> is(temp, "basis")
[1] FALSE
In contrast, is() does catch parent S4 classes:
> library(copula)
> norm.cop <- ellipCopula("normal", param = c(0.5, 0.6, 0.7),
+ dim = 3, dispstr = "un")
2007 Mar 31
1
Problem with S4 inheritance: unexpected re-initialization?
Dear all,
To explain my problem I am attaching a demonstration package "myclasspkg":
I have the following two S4 classes with similar inheritance:
SubSubClassA <- SubClassB <- BaseClass
SubSubClassB <- SubClassB <- BaseClass
In R I am calling the following functions:
> library(myclasspkg)
> subA <-
2010 Jan 11
1
HoltWinters Forecasting
Hi R-users,
I have a question relating to the HoltWinters() function. I am trying to
forecast a series using the Holt Winters methodology but I am getting some
unusual results. I had previously been using R for Windows version 2.7.2 and
have just started using R 2.9.1. While using version 2.7.2 I was getting
reasonable results however upon changing versions I found I started to see
unusual