Displaying 20 results from an estimated 100 matches similar to: "Problem with setValidity() or resetClass() or ... ?"
2011 May 30
1
Query super- and subclasses of a class: is there a better way than to use 'completeClassDefinition()'
Dear List,
when I first started to use S4 classes, I used the function
'completeClassDef()' in order to see the super- and subclasses of a
certain class:
setClass(Class="A", representation=list(a="numeric"))
setClass(Class="B", contains="A", representation=list(b="character"))
# Super
x <- completeClassDefinition("B")
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
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
2011 Oct 10
4
Type of Graph to use
Hi,
Please advice on what type of graph can be used to display the following
data set.
I have the following:
Name Class
a Class 1
a Class4
b Class2
b Class1
d Class3
d Class5
e Class4
e Class2
So each entry in name can belong to more than one class. I want to represent
the data as to see where
2005 Nov 06
2
cox models
Hello,
i'm a french student of medical oncology and i'm working on breast
cancer. I have a variable with the histologic type of tumor wich is
between 1 and 5. I use as.factor function to make some variable with
level between 1 and 5. When i put it in the cox model i have only the
level between 2 and 5. The level 1 doesn't appear. I think i have to
change the number of level but i
2007 Dec 23
1
Problem with initialize of S4 classes
Dear all
Below is the code for "scriptPreFilter.R" which gives the following result:
> source("scriptPreFilter.R")
> prefltr <- new("PreFilter", mad=c(0.5,0.01))
[1] "------initialize:PreFilter------"
[1] "------initialize:Filter------"
> str(prefltr)
Formal class 'PreFilter' [package ".GlobalEnv"] with 2 slots
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"),
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 <-
2012 Jan 26
2
R extracting regression coefficients from multiple regressions using lapply command
Hi, I have a question about running multiple in regressions in R and then
storing the coefficients. I have a large dataset with several variables,
one of which is a state variable, coded 1-50 for each state. I'd like to
run a regression of 28 select variables on the remaining 27 variables of
the dataset (there are 55 variables total), and specific for each state, ie
run a regression of
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
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
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
2012 Aug 07
5
summing and combining rows
Hello,
I have a data set that needs to be combined so that rows are summed by a
group based on a certain variable. I'm pretty sure rowsum() or rowsums()
can do this but it's difficult for me to figure out how it will work for
my data based on the examples I've read.
My data are structured like this:
Plot SizeClass Stems
12 Class3 1
12 Class4
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
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))
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
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
2002 Aug 07
1
No subject
I've got a table of 1 row per observation.
16 questions * n subjects * 4 classrooms (2 teachers * 2 conditions)
I'd like to run some simple regressions that look something like this:
lm(length ~ elapsed)
I'd like to do the regressions several times, split out by
questionkey, student, class. What I've been doing is using a series
of which's to create new data sets (e.g.