search for: setoldclass

Displaying 20 results from an estimated 83 matches for "setoldclass".

2015 Nov 04
1
setOldClass("xts")
Hello, I apologize that I am cross posting here after getting no answer from my initial question on stack overflow <http://stackoverflow.com/questions/33492601/r-setoldclass-only-if-needed>. I should certainly have posted it first here.. I am using 3 packages: - xts - quantmod - 'myPackage' quantmod is creating a union class by doing: setOldClass("xts"); setClassUnion("xtsORzoo", c("xts","zoo")) In '...
2020 Sep 24
2
Is it possible to simply the use of NULL slots (or at least improve the help files)?
Hi Martin, Thankyou for your response. I suspect that we're not going to agree on the main point. Making it trivially simple (as say Java) to set slots to NULL. So, I'll move on to the other points here. ***Note that cited text uses excerpts only.*** > setClassUnion("character_OR_NULL", c("character", "NULL")) > A = setClass("A", slots =
2012 May 03
1
* operator overloading & setOldClass
Dear R gurus, I am trying to overload some operators in order to let these work with the ff package by registering the S3 objects from the ff package and overloading the operators as shown below in a reproducible example where the "*" operator is overloaded. require(ff) setOldClass(Classes=c("ff_vector")) setMethod( f="*", signature = signature(e1 = c("ff_vector"), e2 = c("ff_vector")), definition = function (e1, e2){ e1[] * e2[] } ) ff(1:10) * ff(1:10) It looks like the ff(1:10) * ff(1:10) is not recognising the fa...
2019 Sep 06
2
Cryptic error message from namespaceExport
Dear all, Today I got this error message (R 3.6.1) when installing my package: Error: package or namespace load failed for ?inlatools? in namespaceExport(ns, exports): undefined exports: .__C__inla My package was using setOldClass("inla") and exported the "inla" class via the NAMESPACE. It imports functions from the INLA package. Older versions of the INLA package did not export the "inla" class. Hence the use of setOldClass(). The current version of the INLA package does export the "inla&q...
2009 Dec 15
1
S4 dispatch and S3 "connection" objects
Hello, I'm trying to get S4 dispatch on S3 "connection" objects. So I do : setOldClass( "connection" ) and then : setGeneric( "bling", function(object) standardGeneric( "bling" ) ) setMethod( "bling", "connection", function(object) cat( "gotcha ", as.integer(object), "\n" ) ) but I get : f <- file( "bl...
2019 Sep 06
1
Cryptic error message from namespaceExport
Dear Michael, my package has setOldClass("inla") and the NAMESPACE contains exportClasses(inla) and importFrom(INLA, inla.posterior.sample) the old version of INLA uses the S3 class "inla" but does not export it. the new version of INLA has setOldClass("inla") and the NAMESPACE contains exportClasses(inla)...
2020 Sep 24
0
Is it possible to simply the use of NULL slots (or at least improve the help files)?
Answering to convey the 'rules' as I know them, rather than to address the underlying issues that I guess you are really after... The S4 practice is to use setOldClass() to explicitly treat an S3 character() vector of classes as an assertion of linear inheritance > x <- structure (sqrt (37), class = c ("sqrt.prime", "numeric") ) > is(x, "maybeNumber") [1] FALSE > setOldClass(class(x)) > is(x, "maybeNumber")...
2009 Sep 15
2
S3 objects in S4 slots
...t;; is(value, \"list\") is not TRUE") The last part of the message claims that ``is(value, "list") is not TRUE'', but is(a, "list") is certainly TRUE. (??) On a side note, it does work when "list" is the first entry in class(). I tried to use setOldClass, but seemingly using list is not possible because it does not extend oldClass, or I didn't find out how to do it: > setOldClass(c("VCorpus", "Corpus", "list")) Error in setOldClass(c("VCorpus", "Corpus", "list")) : inconsistent ol...
2005 Aug 11
1
Registering S3 class from external package
...ing similar? Current attempt is something like the following: setHook(packageEvent("somepkg", "attach"), function(...) { cat("* Register", sQuote("oldstyle"), "as S3 class", "\n") setOldClass(c("oldstyle", "data.frame"), where = asNamespace("mypkg")) }) ----------------- > require(mypkg) Loading required package: mypkg ... > require(somepkg) Loading required package: somepkg * Register 'oldstyle' as S3 cla...
2004 Aug 25
0
S3 classes in S4 class definitions
One of the changes some packages are noticing from the recent modifications to methods is warnings of "undefined classes" during installation when the package extends S3 classes or uses them as slots UNLESSS they have been declared in a setOldClass() call. The green book "strongly recommends" declaring S3 classs this way (pp 449-451). The warnings on undeclared classes threatened in the book have now been implemented ;-) (However the statement in the book that S3 inheritance is not used in dispatching S4 methods is not true. Onc...
2002 Sep 10
0
Old-style classes: bug fix & request
...ced in version 1.6 failed to "initialize" some old-style (aka "S3") classes, producing possible warning messages if those classes were used in the signature of a method in the methods package. The real bug, though, was that old-style inheritance could not be included, until the setOldClass function was provided. Initializing the methods package now defines a number of old-style classes, some with inheritance. The bug & its fix are only relevant if you want to use old-style classes in defining formal methods. Request: The request is for input on other classes that need to be i...
2015 May 28
3
S4 inheritance and old class
...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") setClass( Class = "A", contains = "AOld", slots = list(A = "character") ) .DollarNames.A <- function(x, pattern) grep(pattern, slotNames(x), value = TRUE) setClass( Class = "B", contains = "A", slots =...
2007 Apr 15
1
unable to find inherited method for function "edges", for signature "ugsh", "missing"
I am new to using S4 methods and have run into this problem (on Windows XP using R 2.4.1): I am writing a package in which I use the graph package. I define my own classes of graphs as: setOldClass("graphsh") setOldClass("ugsh") setIs("ugsh", "graphsh") (I know that I "should have" used setClass instead - and I will eventually - but right now I am just puzzled about the reason for my problem...) I need an 'edges' method for ugsh gra...
2015 May 28
0
S4 inheritance and old class
...hat 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") > > setClass( > Class = "A", > contains = "AOld", > slots = list(A = "character") > ) > > .DollarNames.A <- function(x, pattern) > grep(pattern, slotNames(x), value = TRUE) Instead of setOldClass, d...
2019 Sep 06
0
Cryptic error message from namespaceExport
Just to clarify, your package is exporting a class that is not defined? Or is it exporting a class that is defined by a dependency and then masked by setOldClass()? A simple reproducible example would help. On Fri, Sep 6, 2019 at 7:48 AM Thierry Onkelinx via R-devel <r-devel at r-project.org> wrote: > > Dear all, > > Today I got this error message (R 3.6.1) when installing my package: > > Error: package or namespace load failed for...
2008 Jul 28
0
S4 classes that extend S3 classes
...remains a reason to hesitate. But a recent change to the 2.8.0 development version takes some steps to reduce the second problem. The mechanism is to include the S3 class of objects as a special slot in any class that extends "oldClass"; therefore, any S3 class registered by calling setOldClass(), and any S4 class that extends such a class, will have the underlying S3 class available. S3 method dispatch and the inherits() function make use of this information in the latest version (revision r46128 of July 27, with a bug fix r46136 July 28). So if you can live with the limitations of...
2011 Apr 06
2
R CMD check for 2.13 rc
...k.log:Error : object normalizePath is not exported by 'namespace:utils' ./Repitools.Rcheck/tests/tests.Rout.fail:Error : object 'normlizePath' is not exported by 'namespace:utils' I haven't got a clue where to look next. My second concern is that I have used the code: setOldClass("AffymetrixCelSet") to make an S3 class be S4 dispatchable on. But R 2.13 wants me to document this class that I don't own: * checking for missing documentation entries ... WARNING Undocumented S4 classes: AffymetrixCelSet Is this truly necessary ? ------------------------------...
2011 Apr 20
2
Package Name Not Found Warning
Hello, I've got a DESCRIPTION file with a the first line: Package: Repitools But, when I run R CMD INSTALL Repitools I get: * installing *source* package Repitools ... ** R ** data ** inst ** preparing package for lazy loading Warning in FUN(X[[1L]], ...) : Created a package name, "2011-04-20 09:05:40", when none found ** help *** installing help indices ** building package
2009 Jun 29
1
S4 and connection slot [Sec=Unclassified]
Hi all, I am having a problem trying to declare a slot representation to hold a file connection. With V2.8.0 I had been using: setClass("Element", representation( [other slots removed], datafileConn = setOldClass(c("file","connection")) ) ) This resulted in a warning but still ran okay. No however with V2.9.0 I am getting an error: Error in representation(state = "list", initialState = "list", polygons = "list", : element 12 of the represe...
2015 May 13
2
Unexpected failure when calling new() with unnamed arg and
...e been initialized first in > | .InitBasicClasses. NB: the methods package will NOT set up > | prototypes for S3 classes except those in package base and for "ts" > | (and would rather not do those either). The package that owns the > | S3 class should have code to call setOldClass in its > | initialization. > > So, when John Chambers wrote this, he envisioned that the > 'stats' package would do "the correct thing" for its own classes. > OTOH, as history went, the stats package was never allowed to > depend on methods. > There are many...