similar to: Inheriting from "environment" and similar object types

Displaying 20 results from an estimated 10000 matches similar to: "Inheriting from "environment" and similar object types"

2018 Mar 18
0
`@<-` modify its argument when slot is externalptr
On Sun, 18 Mar 2018, Jialin Ma wrote: > Dear all, > > I am confused about the inconsistent behaviors of `@<-` operator when > used in different ways. Consider the following example: > > library(inline) > > # Function to generate an externalptr object with random address > new_extptr <- cfunction(c(), ' > SEXP val = PROTECT(ScalarLogical(1)); >
2006 Apr 21
0
Questions on version arg to setClass and serialized instances
I have a few questions and thoughts regarding class versioning and serialized S4 class instances. How is the version argument to setClass is intended to work? It appears to want an externalptr, but that seems odd to me. setClass("FOO", representation(x="numeric"), version="1.2.3") Error in validObject(.Object) : invalid class
2015 Dec 19
0
For integer vectors, `as(x, "numeric")` has no effect.
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Sat, 12 Dec 2015 10:32:51 +0100 writes: >>>>> John Chambers <jmc at r-project.org> >>>>> on Fri, 11 Dec 2015 10:11:05 -0800 writes: >> Somehow, the most obvious fixes are always back-incompatible these days. >> The example intrigued
2015 Dec 12
2
For integer vectors, `as(x, "numeric")` has no effect.
>>>>> John Chambers <jmc at r-project.org> >>>>> on Fri, 11 Dec 2015 10:11:05 -0800 writes: > Somehow, the most obvious fixes are always back-incompatible these days. > The example intrigued me, so I looked into it a bit (should have been doing something else, but ....) > You're right that this is the proverbial
2015 Dec 26
0
[Bioc-devel] For integer vectors, `as(x, "numeric")` has no effect.
Or maybe the "right" concept is that "numeric" is a virtual class with 3 subclasses: "complex", "double", and "integer". Anyway it's probably too late for implementing the "right" concept so it doesn't really matter. Thanks Martin for offering to fix the as(1L, "numeric") bug. Very much appreciated. I guess that means
2008 Oct 30
0
(PR#13209) Arith ops dropping S4 *and* 'object' bit [Was: ...]
>>>>> "JMC" == John Chambers <jmc at r-project.org> >>>>> on Tue, 28 Oct 2008 11:50:38 -0400 writes: JMC> The asymmetry is just the symptom of a more fundamental JMC> issue: There are no operator methods currently defined JMC> for "vector" classes, either combined with each other JMC> or with a non-S4 object.
2016 Jan 05
2
For integer vectors, `as(x, "numeric")` has no effect.
On Dec 19, 2015, at 3:32 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote: >>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>>> on Sat, 12 Dec 2015 10:32:51 +0100 writes: > >>>>>> John Chambers <jmc at r-project.org> >>>>>> on Fri, 11 Dec 2015 10:11:05 -0800 writes: >
2015 Dec 19
2
For integer vectors, `as(x, "numeric")` has no effect.
As I tried to say on Dec. 11, there are two levels of "fix": 1. The fix to the complaint in the OP's subject heading is to conform to the default third argument, strict=TRUE: as(1L, "numeric") == 1.0 This generates some incompatibilities, as for classes that extend "numeric". But still leaves class(1.0) "numeric" and typeof(1.0) "double".
2004 Sep 07
2
as(object,"list") as(object,"matrix") differences?
Hello! as(object,"list") and as(object,"matrix") behave quite differently if it comes to their attributes. I define two classes. One of them "contains" a "list" the other a "matrix" setClass("myclass" ,representation(info="character") ,contains="matrix" ) setClass("mylist"
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
2015 Dec 11
3
For integer vectors, `as(x, "numeric")` has no effect.
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 8 Dec 2015 15:25:21 +0100 writes: >>>>> John Chambers <jmc at r-project.org> >>>>> on Mon, 7 Dec 2015 16:05:59 -0800 writes: >> We do need an explicit method here, I think. >> The issue is that as() uses methods for the generic
2002 Nov 05
1
function showMethods and inheritance
Hi, The following question might come from my (deep) misunderstanding of the concepts in the package 'methods'. I have a class 'A', and a class 'B' inheriting 'A' (so defined with 'setClass' and the parameter 'contains="A"'. The class A has a method 'mymethod'. A call to 'showMethods("mymethod")' return the
2010 Jan 24
1
recursive data-structures in R - An S4 "node" Class
Hi, In an effort to learn S4 objects, I am trying to port some c based tree code to S4 object. My immediate goal is to use .Call() interface for calling my c code from R. My long term goal is to understand how to write c structs that follows S4 classes and not the other-way-around. The c struct for the node is : typedef struct node{ int c; int n; inode **nodes; //length = n } inode; I
2004 Sep 29
1
Problem with _new_ if class "lm" in object representation.
Hi! Consider this code. setClass("Ctest" ,representation( test="character" ,bla="character" ,mod="lm" ) ) new("Ctest",test="bla") #This produces an error. #Error in validObject(.Object) : Invalid "Ctest" object: Invalid object for slot "mod" in class "Ctest": got class
2004 Aug 25
0
S3 classes in S4 class definitions
One of the changes some packages are noticing from the recent modifications to methods is warnings of "undefined classes" during installation when the package extends S3 classes or uses them as slots UNLESSS they have been declared in a setOldClass() call. The green book "strongly recommends" declaring S3 classs this way (pp 449-451). The warnings on undeclared classes
2014 May 22
1
Excluding objects from save.image
When dealing with object holding pointers that are only valid during a single session, it would be convenient to exclude them from being saved with the session image. (I am assuming that `quit` calls `save.image` before quitting or is it internal?) Currently they are saved with the pointer converted to NULL. Its a bit surprising for users not realizing the object is no longer valid. My thought is
2018 Mar 18
3
`@<-` modify its argument when slot is externalptr
Dear all, I am confused about the inconsistent behaviors of `@<-` operator when used in different ways. Consider the following example: library(inline) # Function to generate an externalptr object with random address new_extptr <- cfunction(c(), ' SEXP val = PROTECT(ScalarLogical(1)); SEXP out = PROTECT(R_MakeExternalPtr(&val, R_NilValue, val)); UNPROTECT(2);
2003 May 30
2
Creating a vector class
I'm trying to create a package for working on orientation data, i.e. data where the observations are 3D rotations. There are several different representations of orientations in common use: SO(3) matrices, Euler angles, unit quaternions, etc. One thing I'd like is to make it convenient to work in any representation, and have conversions to others done as needed. I'm trying to do
2007 Jun 04
2
locked environment and inheritance
Hi, I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create a S4 class which extends (adds 2 slots) another S4 class from some other package. The class should be created in "myPkg" environment (and not global environment). Using: setClass("myS4class", representation("otherS4class", mydata = "numeric"),
2003 May 21
1
callNextMethod
Hi, I don't understand why this code doesn't work (f(b2)): ///////////////// setClass("B0", representation(b0 = "numeric")) setClass("B1", representation("B0", b1 = "character")) setClass("B2", representation("B1", b2 = "logical")) f <- function(x) class(x) setMethod("f", "B0",