similar to: 2 possible bugs in function validObject (PR#7735)

Displaying 20 results from an estimated 1000 matches similar to: "2 possible bugs in function validObject (PR#7735)"

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 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"),
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 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
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
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
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,
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
2009 Jun 18
1
validObject throws non-caught error when slot doesn't exist
I have been retooling an S4 class definition to include another slot and have found that the methods::validObject function (defined in methods/R/SClasses.R) in R-devel throws an error that isn't caught internally (and thus not controllable by 'test' argument) when retrieving a non-existent slot. The offending line of code is shown below: > validObject function (object, test =
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"
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 <-
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!
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 Jul 06
1
Enumeration in R
I want the equivalent of this 'C' declaration. enum StoplightColor { green = 3, yellow = 5, red = 7 }; This mostly works except the validity checking doesn't seem to occur automatically. What didn't I do to enable it? setClass("stoplightColor", representation(value = "integer"), prototype = integer(1))
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
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>,
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 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
2017 Aug 14
0
tidyverse repeating error: "object 'rlang_mut_env_parent' not found"
The most likely explanation is you have a new version of dplyr/tibble and an old version of rlang. Try re-installing rlang. Hadley On Mon, Aug 14, 2017 at 9:26 AM, Szumiloski, John <John.Szumiloski at bms.com> wrote: > UseRs, > > When doing some data manipulations using the tidyverse, I am repeatedly getting the same error message in now three separate situations. I can write up
2006 May 09
1
combn(n, k, ...) and all its re-inventions
It seems people are reinventing the wheel here: The goal is to generate all combinations of 1:n of size k. This (typically) results in a matrix of size k * choose(n,k) i.e. needs O(n ^ k) space, hence is only applicable to relatively small k. Then alternatives have been devised to generate the combinations "one by one", and I think I remember there has been a quiz/challenge about 20