Displaying 20 results from an estimated 55 matches for "iss4".
Did you mean:
iss
2012 Oct 04
1
identical() fails to compare isS4(<S4 instance>) to TRUE
> setClass("A", "integer")
> isS4(new("A"))
[1] TRUE
> identical(isS4(new("A")), TRUE)
[1] FALSE
> sessionInfo()
R Under development (unstable) (2012-10-04 r60876)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLA...
2011 Jun 06
1
Reference Classes: shortcut like 'isS4' for Ref Classes?
Dear list,
is there a shortcut-function to check whether a class is a Reference
Class or not? There's something like this for S4 classes
('isS4(object)'), but I couldn't find anything regarding Ref Classes.
Currently, I'm doing it this way, which is a bit clumsy:
A <- setRefClass("A", fields=list(X="numeric"))
a <- A$new()
isRefClass <- function(object, ...){
return(getClass(class(object))@c...
2010 Jul 28
1
strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
Dear all,
I run a gamm with following call :
result <- try(gamm(values~ s( VM )+s( RH )+s( TT )+s( PP
)+RF+weekend+s(day)+s(julday) ,correlation=corCAR1(form=~ day|month
),data=tmp) )"
with mgcv version 1.6.2
No stress about the data, the error is not data-related. I get :
Error in isS4(x) : object 'VM' not found
What so? I did define the dataframe to be used, and the dataframe
contains a variable VM :
> str(tmp)
'data.frame': 4014 obs. of 12 variables:
$ values : num 73.45 105.45 74.45 41.45 -4.55 ...
$ dates :Class 'Date' num [1:4014] 9862 98...
2010 Jul 12
1
S4 class extends "data.frame", getDataPart sees "list"
R-Devel:
When I get the data part of an S4 class that contains="data.frame", it gives
me a list, even when the "data.frame" is the S4 version:
> d<-data.frame(x=1:3)
> isS4(d)
[1] FALSE # of course
> dS4<-new("data.frame",d)
> isS4(dS4)
[1] TRUE # ok
> class(dS4)
[1] "data.frame" # good
attr(,"package")
[1] "methods"
> setClass("A", r...
2020 Oct 23
2
Change to I() in R 4.1
Hi there,
Is that change in R-devel intentional?
library(Matrix)
m <- as(matrix(c(0, 1)), "sparseMatrix")
isS4(m)
# [1] TRUE
x <- I(m)
# Warning message:
# In `class<-`(x, unique.default(c("AsIs", oldClass(x)))) :
# Setting class(x) to multiple strings ("AsIs", "dgCMatrix", ...);
result will no longer be an S4 object
isS4(x)
# [1] FALSE
This wor...
2017 Sep 22
2
S4 method implementation for S3 class
Hi all,
I'm trying to implement the matrix multiplication operator, which is
S4 generic, for an old-style S3 class. The following works as
expected:
x <- 1:10
class(x) <- "myClass"
setOldClass("myClass")
setGeneric("myMethod", function(x, y) standardGeneric("myMethod"))
setMethod("myMethod", c("myClass", "myClass"),
2020 Oct 30
2
Change to I() in R 4.1
Hi Martin,
On 10/26/20 04:52, Martin Maechler wrote:
>>
>> Hi there,
>> Is that change in R-devel intentional?
>>
>> library(Matrix)
>> m <- as(matrix(c(0, 1)), "sparseMatrix")
>>
>> isS4(m)
>> # [1] TRUE
>>
>> x <- I(m)
>> # Warning message:
>> # In `class<-`(x, unique.default(c("AsIs", oldClass(x)))) :
>> # Setting class(x) to multiple strings ("AsIs", "dgCMatrix", ...);
>> result w...
2020 Oct 30
1
[External] Re: Change to I() in R 4.1
...ject>" which is
>> misleading). Anyways, these 2 issues are separated from the main issue
>> and can be dealt with later.
>
> 1b. A variant of the above could be to use the old implementation for S4
> objects only:
>
> I <- function(x)
> {
> if (isS4(x)) {
> structure(x, class = unique.default(c("AsIs", oldClass(x))))
> } else {
> `class<-`(x, unique.default(c("AsIs", oldClass(x))))
> }
> }
>
> That is probably a good compromise for now.
Not really. The underlying pr...
2017 Sep 22
2
S4 method implementation for S3 class
...created to store them. Calls to the
> primitive still go directly to the C code, which will sometimes
> check for applicable methods. The definition of ?sometimes? is
> that methods must have been detected for the function in some
> package loaded in the session and ?isS4(x)? is ?TRUE? for the
> first argument (or for the second argument, in the case of binary
> operators).
>
> But:
>> isS4(x)
> [1] FALSE
>
> I think this behavior is in the interest of performance. It avoids
> adding S4 dispatch overhead to e.g. matrix objects...
2019 Sep 11
2
'==' operator: inconsistency in data.frame(...) == NULL
...the example below even on the same machine.
However, the following example produces the same error as NULL values in
prior examples:
> setClass("FOOCLASS",
+????????? representation("list")
+ )
> ma = new("FOOCLASS", list(M=matrix(rnorm(300), 30,10)))
> isS4(ma)
[1] TRUE
> data.frame(a=1:3) == ma
Error in matrix(unlist(value, recursive = FALSE, use.names = FALSE),
nrow = nr,? :
? length of 'dimnames' [2] not equal to array extent
Best,
Hilmar
On 11/09/2019 12:24, Hilmar Berger wrote:
> Another example where a data.frame is compared...
2020 Oct 26
0
Change to I() in R 4.1
>
> Hi there,
> Is that change in R-devel intentional?
>
> library(Matrix)
> m <- as(matrix(c(0, 1)), "sparseMatrix")
>
> isS4(m)
> # [1] TRUE
>
> x <- I(m)
> # Warning message:
> # In `class<-`(x, unique.default(c("AsIs", oldClass(x)))) :
> # Setting class(x) to multiple strings ("AsIs", "dgCMatrix", ...);
> result will no longer be an S4 object
&...
2007 Apr 20
1
infinite recursion when printing former S4 objects
...m", matrix())
> z <- as(f, "matrix")
> z
[,1]
[1,] NA
> print(z)
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
An easy cut/paste version is below. I'm seeing this with an R 2.5.0
beta. I noticed that isS4(z) returns TRUE. This may or may not be
surprising, but seems quite related to the issue at hand.
+ seth
## ----------------8<--------------8<-----------------------
setClass("Foo", representation(name="character"), contains="matrix")
f <- new("Foo...
2006 Nov 14
3
Error in str(its-object)
Dear all,
on my Windows XP R 2.4.0 version with Package its version 1.1.4 I have a problem with
str() applied on an its-object after a simple matrix manipulation on the its object (see below).
I am not sure, whether this a problem with my application, its or str().
Of course, one can make
> str(core(its(mat)) / 1)
num [1:2, 1:3] 1 2 3 4 5 6
- attr(*, "dimnames")=List of 2
..$
2019 Sep 14
0
'==' operator: inconsistency in data.frame(...) == NULL
...t failing in the same code line due to
incompatible dimensions.
# should Ops.data.frame at all be dispatched for <data.frame> == <S4
object> ?
setClass("FOOCLASS",
????????? representation("list")
)
ma = new("FOOCLASS", list(M=matrix(rnorm(300), 30,10)))
isS4(ma)
d_3 == ma # error A
##########################################################################################
Best regards,
Hilmar
Am 11/09/2019 um 13:26 schrieb Hilmar Berger:
> Sorry, I can't reproduce the example below even on the same machine.
> However, the following example...
2019 Sep 11
2
'==' operator: inconsistency in data.frame(...) == NULL
Dear Martin,
On 11/09/2019 09:56, Martin Maechler wrote:
>
> > I wonder if data.frame(<some non-empty data>) == NULL should also return
> > a value instead of an error. R help reads:
>
> > "At least one of |x| and |y| must be an atomic vector, but
> > if the other is a list R attempts to coerce it to the
> > type of the atomic
2017 Sep 22
0
S4 method implementation for S3 class
...ata objects will be created to store them. Calls to the
primitive still go directly to the C code, which will sometimes
check for applicable methods. The definition of ?sometimes? is
that methods must have been detected for the function in some
package loaded in the session and ?isS4(x)? is ?TRUE? for the
first argument (or for the second argument, in the case of binary
operators).
But:
> isS4(x)
[1] FALSE
I think this behavior is in the interest of performance. It avoids
adding S4 dispatch overhead to e.g. matrix objects.
In general, it's best to define an...
2020 Oct 30
0
Change to I() in R 4.1
...e fixed (it says "<S4 Type Object>" which is
> misleading). Anyways, these 2 issues are separated from the main issue
> and can be dealt with later.
1b. A variant of the above could be to use the old implementation for S4
objects only:
I <- function(x)
{
if (isS4(x)) {
structure(x, class = unique.default(c("AsIs", oldClass(x))))
} else {
`class<-`(x, unique.default(c("AsIs", oldClass(x))))
}
}
That is probably a good compromise for now.
I would also suggest that the "package" attribut...
2010 Aug 01
2
How to understand whether a class is a S3 class?
Hi, is there any way to say: "this class 'x' is a S3 class?" For example what is the type of class "data.frame"? Is it a S3 class or S4?
How can I get a complete list of all S3 classes currently available?
Thanks,
2006 Sep 03
1
Internal flag for S4 objects
A recent revision (svn version 39077) has introduced an internal flag (a
bit in the C structure) that is turned on by the code that generates
objects from an S4 class.
There are corresponding tests for an S4 object, isS4() in R and
IS_S4_OBJECT() in C. These are fast and reliable, and should replace
any heuristic tests previously used.
The tests are not currently used widely, but in the future could be
combined with some of the other recent changes to improve reliability
and efficiency of computations with S4...
2011 Mar 10
1
Testing for a reference class object
Hi all,
I've constructed the following function to test whether or not an
object was created from a reference class:
isRefClassObject <- function(x) isS4(x) &&
is.environment(attr(x,'.xData')) &&
exists('.refClassDef',attr(x,'.xData'))
but I'm unsure if it's a complete test or if there's a better way to
test. Regardless, It would be nice to have such a function in the
methods package.
I have a ca...