similar to: What does is() mean?

Displaying 20 results from an estimated 1600 matches similar to: "What does is() mean?"

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
2009 Oct 26
1
Why 'validity' is not called? (S4)
I thought that 'validity' defined in 'setClass' should be called in 'new'. Could somebody let me know why 'validity' is not called? How to make it be called? > setClass( + Class='A', + representation=representation( + x='numeric' + ), + validity=function(object){ + cat("~~~ A: inspector ~~~\n") +
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
2012 Jan 10
1
Can "prototype" and "initialize" coexist?
Folks, My object oriented background is in Java and C++. I am a novice to using S4/object-oriented coding in R but not to R. Below is an example that I found that I have expanded on. I am not getting how "prototype" and "initialize" work together, if at all. Here is output from a short "session" > setClass("xx", +
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
2009 Jun 05
2
S4: When is validObject issued? (or why S4 is killing me:( ..
Dear UseRs, Does anyone know when exactly the validity is checked in S4? Documentation is silent:(. Here is a small example: setClass("test1",representation(a="numeric")) setMethod("initialize","test1", function(.Object,...){ a<-runif(1) ## here slot "a" is initialized ## callNextMethod(.Object,a=a,...)
2008 Feb 08
2
learning S4
Hi the list. I try to learn the S4 programming. I find the wiki and several doc. But I still have few questions... 1. To define 'representation', we can use two syntax : - representation=list(temps = 'numeric',traj = 'matrix') - representation(temps = 'numeric',traj = 'matrix') Is there any difference ? 2. 'validityMethod' check the
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
2010 Feb 02
1
S4 setClass / initialize misunderstanding
Hi, I recently ran into this problem. I couldn't find any mention of it in the setClass documentation. setClass("Foo", representation(file = "character")) setMethod("initialize", "Foo", function(.Object, file) { print(file) }) setClass("Bar", contains = "Foo") And the error: Error in print(file) : argument "file" is
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 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 Jan 30
1
S4 initialize or "generating function"
Hello, apologies if I missed something well known. I'm just revising an own package and wonder if it is still common to use "generating functions" which have the same name as the corresponding S4 class as suggested by Chambers, 2001. "Classes and Methods in the S Language". -- or should one consequently use new and initialize to do such things? Thank you Thomas P.
2006 Mar 06
1
validObject does not check validity of slots
The documentation for validObject suggests that slots are checked for validity, but validObject seems only to check that the slot has something claiming to be correct; validObject(obj) does not perform the equivalent of validObject(obj at y) for slot y. This is also the second problem issue reported in http://tolstoy.newcastle.edu.au/R/devel/05/03/0151.html Relevant documentation, an example,
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 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
2003 Apr 01
1
setGeneric
I'm still having difficulties with methods...is the following behavior expected? (This is without loading any libraries) R : Copyright 2003, The R Development Core Team Version 1.7.0 Under development (unstable) (2003-03-31) > ls() character(0) > > diag(2) [,1] [,2] [1,] 1 0 [2,] 0 1 > setGeneric("diag") [1] "diag" > diag(2) Error in
2009 Aug 17
2
S4: inheritance of validity methods?
Dear Developers, In current implementation of validity method, objects are first coerced to superclass (slots are striped). Thus, it is not possible to write validity method which would perform some checks on children slots. Say, I want to check if number of slots in a class is equal to "n": setClass("A", representation(a="numeric", n="integer"),
2006 Sep 21
1
validity testing as part of '@<-'
'methods' package feature request / discussion starter: perhaps a call to 'validObject' should occur at part of any slot replacement operation (and the operation not be carried out if it would invalidate the object)? this may prevent the need for prophylactic 'validObject' calls in other user-defined functions. in the example below, the slot assignment occurs
2010 May 06
1
Validity glitch when contains="matrix"
Sirs: My validity function did not run when my class contains="matrix". But if I first define the class with contains="numeric", then define it again with contains="matrix", validity runs. Here's the session: > f <- function(object) "BAD CLASS" # force error to > setClass("A", contains="matrix", validity=f) [1]