similar to: Problem with initialize of S4 classes

Displaying 20 results from an estimated 200 matches similar to: "Problem with initialize of S4 classes"

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 <-
2007 Mar 04
1
Problem using callNextMethod() in S4
Dear all, Maybe, I am doing something wrong, but using R-2.5.0 on my Intel-Mac, I have problems using function callNextMethod() in method initialize. I am loading the following code as file "testS4.R": setClass("baseClass", representation(myname = "character", mydir = "character", "VIRTUAL"),
2010 Mar 08
1
setClass or setValidity?
Hi,   I'm reading up on S4 classes *). There seem to be at least two ways of input validation: setClass() (using the 'validity' argument)  and setValidity(). Is it a matter of taste which function is used? Or should more complex validation code better be put in a setValiditity call? *) A (Not So) Short Introduction to S4 Object Oriented Programming in R V0.5.1 Christophe Genolini
2008 May 07
1
optional setValidity()
Hi Suppose I have an S4 class "foo" and a validity checking function ".checkfoo()": setClass("foo", representation=representation("numeric")) setValidity("foo" , .checkfoo) is fine; in my application, .checkfoo() verifies that a bunch of necessary conditions are met. But .checkfoo() is very time consuming and I want to give users the option
2003 Nov 19
2
Was: setValidity and "initialize" method conflict ? [in R-help]
Hello, Thomas Stabla (statho3@web.de) has already sent this question to R-help, Wed, 12 Nov 2003 21:21:31 +0100, but we are not sure whether we should better post this mail to this audience than to R-help: --------------------------------------------------------------------- We are using S4-classes and want to force a validity check when an object is created. How can this be done, when an
2007 Apr 19
2
setClass inside a function
Hello, I would like to create a function that gets passed a class name and then calls setClass, and a few other functions, inside. I have done this in the past with setmethod, creating accessors for all slots in a set of S4 classes. But setClass is choking when my function is called isnide a package, telling about an error in exists(cname, where). I assume this to be a problem with the
2019 Aug 19
1
class() bug when used within a validity method
Hi, This is a long-standing bug where 'class(object)' does not return the actual class of 'object' when used inside a validity method. Instead it seems to return the class for which the validity method is defined. For example: setClass("A", slots=c(stuff="ANY")) setValidity("A", function(object) { cat("validating an object of
2004 Jun 18
0
Problem with setValidity() or resetClass() or ... ?
Hi, I'm working with Version 1.9.0 (2004-04-12) on Windows 98/NT/2000 where I found the following wrong (?) behavior of setValidity(). I already mentioned this on the R-help list (2004-06-11, was "setValidity changes Extends?") , but as I got no answer I tried to figure out what's happening. Well, setValidity() behaves not as I would expect (something about the
2007 Jul 25
2
initalizing and checking validity of S4 classes
Dear useRs and wizaRds, I am currently developing a set of functions using S4 classes. On the way I encountered the problem exemplified with the code below. For some reason the 'validity' method does not seem to work, i.e. does not check for errors in the specification of the slots of the defined class. Any hints? My understanding of the whole S4 system was that validity checks are made
2008 Apr 15
1
Pb with validObject(..., complete=TRUE)
Hi, When called with complete=TRUE, validObject() is supposed to work in a recursive manner. But here is a situation where it doesn't seem to be the case. Let's define a class with a validity method: setClass("PosInts", representation(ii="integer")) setValidity("PosInts", function(object) { if (!all(object at ii > 0))
2009 Jul 09
1
How to: initialize, setValidity, copy-constructor
Hello list, I'm having troubles setting up a basic calss hierarchy with S4. Here is a simplified schema of what I'd like to do: - Two classes: A and B that extends A - Ensure that the slots added by B are consistent with the slots of A - Let A initialize itself (I'm not supposed to know the internal cooking of A) - By default set the slots of B based on the slots that A initialized
2004 Jan 29
2
Object validation and formal classes
I'm using R 1.8.1 (Win32, Linux) and have some difficulties using validation functions for S4 classes. The problem is if I specify a validation function with setValidity("myclass", validate.myclass) object validation is only performed when I create an instance using new("myclass"), or when I explicitly call validObject(x) where x is of class "myclass", of
2004 Apr 20
0
SAMBA 3.0.2 printing problem
Hi I've recently upgraded to 3.0.2 from 2.2.8 on Redhat 9. We have 2 Linux servers and a number of windows XP machines. The primary domain controller has a printer which is shared and to which all the computers have access. Since upgrading, the other Linux server cannot print to shared printers on the primary linux controller or on windows machines and cannot install new shared printers from
2008 Feb 29
1
Problems initializing an extended S4 class
Hi all, I am having trouble extending S4 classes in cases where I'm using both validity and initialize methods. I've read as much S4 information as I can find, but I've yet to have that "a-ha" moment. In my application, I am using validity methods to guard against inappropriate input data that my code has no way of handling, and initialize methods to detect and deal
2009 Mar 20
1
classes and methods
I have put together a test class and methods > setClass("foo",representation(x="numeric")) [1] "foo" > setMethod("plot","foo",function(x,y,...)boxplot(x,...)) [1] "plot" > x <- rnorm(100) > class(x) <- "foo" > plot(x) > y <- new("foo",x=rnorm(50)) > class(y) [1] "foo" My
2005 Aug 03
0
A question on validity checking for S4 classes
Folks: (This is a question on the formal S4 class system). R 2.1.1 on Windows. I'm pretty sure the following is a failure of my understanding, rather than a bug, so may I ask for some clarification? The Green book states that (p. 295) "Objects are checked for validity when permanently assigned, or explicitly by the function validObject()." The Help for setValidity() seems silent
2005 Mar 18
0
2 possible bugs in function validObject (PR#7735)
Hi, > R.version.string [1] "R version 2.0.1, 2004-11-15" I have found two possible bugs in function validObject. Details below. Cheers, Scott ================================== Scott D. Chasalow Principal Statistician Statistical Genetics and Biomarkers Bristol-Myers Squibb Company Email: scott.chasalow <AT> bms.com ================================== ------ BEGIN R
2011 Dec 12
0
limit ranges in hexbin
Hello everybody, I hope you can give me some help with limiting the ranges in x, y, and z for a hexbin plot. All I have found on the net is an unanswered message to this list from last year, so I hope my problem is not too stupid. I would like to plot some data using hexagonal binning. Currently, I am doing the following: library(hexbin) data<-scan("input.dat", what =
2010 Nov 16
1
Question on new release.
Hi Jean-Marc, First, I just wanted to point out that the link on the download page to download 0.9.1 actually points to the 0.9.0 tarball. I'm pretty excited to try it out. Second, I was wondering if you could tell us what the ENABLE_POSTFILTER conditional compilation flag actually does? Thanks, John Ridges
2011 Apr 18
3
CELT grabbing 100KB of memory right off the top
Is there a particular reason why CELT grabs 100KB of stack immediately? Is that really required or can that be trimmed down some/a lot? -a