similar to: validObject throws non-caught error when slot doesn't exist

Displaying 20 results from an estimated 500 matches similar to: "validObject throws non-caught error when slot doesn't exist"

2008 Nov 20
1
How to convert S4 class slots into data.frame or how to assign variables of type 'Date'
Hi, I created a class (S4) with some slots like value, date, description (it's actually a financial transaction class). Now I need a method to convert this class forth and back into a single row data.frame, where every slots represents a column. This method looks at the moment like this: > setMethod("as.data.frame", "Transaction", function(x, row.names =
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"),
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")
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
2011 Jun 04
1
S4 class, passing argument names to function, modify original
Hello, an S4 class "Foo" is defined with a setter, $. For several reasons, the setter calls a function, .foo.update(). However, bypassing the argument names of the setter does not work. Question 1: Why not and how can I fix this? Question 2: What is the way to define either the function or the setter to modify the original object (not returning the modified copy of it an overwrite the
2009 Aug 30
1
Trying to rename spatial pts data frame slot that isn't a slot()
Dear List, I am analyzing the home range area of fish and seem to have lost the individuals ID names during my manipulations, and can't find out how to rename them. I calculated the MCP of the fish using mcp() in Adehabitat. MCP's were converted to spatial points data frame and exported to qGIS for manipulations. At this point the ID names were lost. I brought the manipulated
2004 Dec 09
2
wishlist -- names gives slotnames (PR#7410)
Full_Name: Elizabeth Purdom Version: 1.9.1 OS: Windows XP Submission from: (NULL) (171.64.102.199) It would be nice if names(obj) would give slot names as well. Since for many people slots are new, the first thing that happens is you try to access what's in them and can't find how to do it. If you don't know that slotNames() exists, it can be very frustrating. Moreover, if you
2008 Jun 07
1
slot(obj, "nosuch") documentation question
Using slot() on object (or "@") and using a nonexistent slotname returns an error (see example code). R> setClass("foobar", representation=list(a="numeric")) [1] "foobar" R> foobar <- new("foobar", a=5) R> foobar at a [1] 5 R> foobar at b Error: no slot of name "b" for this object of class "foobar" The details
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members, Is there a way to test whether an object is an S4 object? The best that I've been able to come up with is isS4object <- function(object) !(is.null(slotNames(object))) which assumes that an S4 object has at least one slot. I think this is safe, but perhaps I'm missing something. Thanks, John -------------------------------- John Fox Department of
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members, Is there a way to test whether an object is an S4 object? The best that I've been able to come up with is isS4object <- function(object) !(is.null(slotNames(object))) which assumes that an S4 object has at least one slot. I think this is safe, but perhaps I'm missing something. Thanks, John -------------------------------- John Fox Department of
2019 Sep 27
0
missing imports not detected by 'R CMD check' (?)
>>>>> Henrik Bengtsson >>>>> on Tue, 24 Sep 2019 11:42:13 -0700 writes [to me (as maintainer of 'Matrix') and allowed me to answer in public] : > I ran into a problem where 'R CMD check' on my in-house package, which > only indirectly depends on 'Matrix', produce errors like: > > [where=<environment: namespace:Matrix>,
2011 Aug 09
2
S4 classes, some help with the basics
Hi All, I have tried to find an answer within documentation, but I cannot: o How can call a class "slot" without knowing the name a priori? E.g., let's say I use the "pcaMethods" library to create a "pcaRes" object. How can I call parts of that object without using the specific names of the object in the call? example code: library(pcaMethods)
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))
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 Nov 28
0
extend validObject to validate any object (shallow and deep validation)
Hi, It would be nice if there was a tool for checking the validity of any object. validObject() is of course the natural candidate for this but right now it doesn't work on S3 objects: df <- data.frame(aa=1:4, bb=letters[4:1]) attributes(df)$row.names <- c("A", "B", "C", "A") 'df' is an invalid data frame instance: > df
2013 Feb 15
1
Iterating through slots of an S4 object
I want to loop through slots of an S4 object and am unsure how to do so since the only way I can find to access them is individually in the form 'object@slotName'. I have guessed at a few possibilities which did not work and I have read some S4 object tutorials and things but still unsuccessful. I presume it is possible though? Any help would be much appreciated, Scott [[alternative
2008 Dec 17
1
glmnet : Error in validObject(.Object) :
Could any one help ? I start to learn the glmnet package. I tried with the example in the manual. x=matrix(rnorm(100*20),100,20) y=rnorm(100) fit1=glmnet(x,y) When I tried to fit the model, I received the error message: Error in validObject(.Object) : invalid class "dgCMatrix" object: row indices are not sorted within columns Thank you very much!
2005 Jun 06
2
Bug in new() or validObject() in methods package (PR#7922)
Something in new() or validObject() in the methods package is messing up. This happens in both 2.1.0 and R-devel in Windows. I'd like to have an empty expression for a slot in a class. An empty expression is an expression: > is.expression(expression()) [1] TRUE > > is(expression(), "expression") [1] TRUE > class(expression()) [1] "expression"
2004 Jan 12
7
3.3v PCI board - TE410P photo
Hi- I have posted a photo of the TE410P Digium card on my site, so that those wishing to purchase a compatible motherboard can see physically what the PCI slot requirement is: http://www.evtmedia.com/TE410P.htm I believe the required slot is a 64-bit, 3.3 Volt PCI, most commonly found on Xeon-based motherboards. A 64-bit slot is longer than the TE410P board requires, but the PCI connector