similar to: Inheriting from factors + co.

Displaying 20 results from an estimated 10000 matches similar to: "Inheriting from factors + co."

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
2009 Feb 11
1
setClassUnion with numeric; extending class union
Dear list: I am looking for a good way to create an S4 class that would extend numeric, but would allow NULL instead of data as well. As far as I can see there is no way at the moment to do that, but please correct me if I am wrong. The best solution I came up with so far was the following (it also indicates a problem of using setClassUnion with numeric as one of the classes): I define a class
2005 Dec 07
1
Dots argument in apply method
Hello everyone, I'm working on a package using S4 classes and methods and I ran into the following "problem" when I tried to create an "apply" method for objects of one of my new classes. I've found a way around the problem but I wonder if I did not paint myself into the corner. I'd like your opinion about that. So I have an object "myObj" of class
2019 Nov 11
2
Troubles using numeric in s4 class union
Hi all, I came across an issue in using the Matrix package which made it that I could only subset Matrices using the numeric class, but could not using integers. Steps to reproduce the problem: library(Matrix) # this class has *nothing* to do with Matrix setClass("MyClass", representation(myvalue = "numeric"), prototype(myvalue = NA_real_)) # this class also has
2009 Sep 23
2
[LLVMdev] About porting llvm-gcc frontend.
I am porting llvm-gcc frontend. We have ported GCC4.2 for our target. So I move *.h *.md and *.c to llvm-gcc.  I do not implement any LLVM MACRO, and use default action of llvm-gcc.  I get a new llvm-gcc for our target. But I get a bug. /******************************/ //#include <stdio.h> union MYunion {   unsigned char uc ;   int ui; } myunion; void vfu1(union MYunion  u) {     u.ui =
2009 Sep 24
0
[LLVMdev] About porting llvm-gcc frontend.
Hi 任坤, > void vfu1(union MYunion u) { > u.ui = 99; > } here u is passed by copy, so vfu1 has no externally visible effect. I think you meant: union MYunion *u > define void @vfu1(%struct.MYunion* byval align 4 %u) nounwind { Here "byval" means that a pointer to a temporary copy of u is being passed, not u itself. Thus any writes to the %u parameter have no effect
2016 Mar 19
2
unary class union of an S3 class
On 03/19/2016 01:22 AM, Michael Lawrence wrote: > > > On Sat, Mar 19, 2016 at 12:10 AM, Herv? Pag?s <hpages at fredhutch.org > <mailto:hpages at fredhutch.org>> wrote: > > On 03/18/2016 03:28 PM, Michael Lawrence wrote: > > > On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s > <hpages at fredhutch.org <mailto:hpages at
2003 Mar 31
1
setIs?
I've recently updated from an early February version of 1.7.0 to Version 1.7.0 Under development (unstable) (2003-03-25) and am now having problems with errors giving the message: ' getExtends(ClassDef) : @ must be used on an object with a formal class' which seems to be caused by 'setIs("character","character or NULL")' which attempts to define
2003 Aug 21
2
efficiency and memory use of S4 data objects
I do lots of analyses on large microarray data sets so memory use and speed and both important issues for me. I have been trying to estimate the overheads associated with using formal S4 data objects instead of ordinary lists for large data objects. In some simple experiments (using R 1.7.1 in Windows 2000) with large but simple objects it seems that giving a data object a formal class
2016 Mar 19
2
unary class union of an S3 class
On 03/18/2016 03:28 PM, Michael Lawrence wrote: > > On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s <hpages at fredhutch.org > <mailto:hpages at fredhutch.org>> wrote: > > Hi, > > Short story > ----------- > > setClassUnion("ArrayLike", "array") > > showClass("ArrayLike") # no slot > >
2004 Jul 28
3
as(obj,"matrix")
Hi! Here a simple example. setClass("myclass" ,representation(info="character") ,contains="matrix" ) rownames(dd)<-c("a","b") tt<-new("myclass",dd) #the source of pain. as(tt,"matrix")<-matrix(1,3,3) Error: length of dimnames [1] not equal to array extent Is there a different way to do what I would like to do (I
2004 Jul 28
3
as(obj,"matrix")
Hi! Here a simple example. setClass("myclass" ,representation(info="character") ,contains="matrix" ) rownames(dd)<-c("a","b") tt<-new("myclass",dd) #the source of pain. as(tt,"matrix")<-matrix(1,3,3) Error: length of dimnames [1] not equal to array extent Is there a different way to do what I would like to do (I
2006 Apr 07
4
setIs and method dispatch in S4 classes
Dear all, I have a question regarding setIs and method dispatch in S4 classes: Consider the following example: ##################################################### ## A02 "contains" A01 by setIs: setClass("A01", representation(a="numeric",b="numeric")) setClass("A02", representation(a="numeric",d="numeric"))
2003 Dec 02
1
setMethod("min", "myclass", ...)
Hello, I have defined a new class > setClass("myclass", representation(min = "numeric", max = "numeric")) and want to write accessor functions, so that for > foo = new("myclass", min = 0, max = 1) > min(foo) # prints 0 > max(foo) # prints 1 At first i created a generic function for "min" > setGeneric("min",
2008 Nov 26
1
S4 slot containing either aov or NULL
Dear listmembers, I would like to define a class with a slot that takes either an object of class aov or NULL. I have been reading "S4 Classes in 15 pages more or less" and "Lecture: S4 classes and methods" #First I tried with list and NULL setClass(listOrNULL") setIs("list", "listOrNULL") setIs("NULL", "listOrNULL") #doesn't
2008 Dec 22
1
How to add a slot to S4 class of an existing package?
Dear all, Since my package is based on S4 classes, I would like to know how to add a slot to an existing S4 class without breaking the code of users of my package. Assume the following S4 class: setClass("MyClass", representation(name = "character", type = "character", data = "data.frame" ), prototype(name =
2011 Jun 06
1
Seeking help to define method for show() for an S4 object
Dear all, I have created a new S4 class with name "MyClass". Please see below for it's definition. Now I want to create a method for the show() function for this class. In defining this method, what I want is, once user would like see an object of this class some values will be displayed. Then R will ask for **press Enter**. Once user presses enter then, remaining values will be
2020 Oct 05
2
S4 - inheritance changed by order of setClassUnion and setAs()
Dear colleagues, there is a behaviour with S4 (virtual) classes that I find very hard to understand: Depending on the position of setAs(), the tree of inheritance changes. This is my baseline example that defines the classes "grandma", "mother", "daughter" and a virtual class "mr_x". For a new instance if "daughter", "mr_x" is betweeen
2005 Jun 02
1
showMethods doubt
Hi, I'm developing in S4 and I wanted to see the methods for a specific class using showMethods but I didn't succed. Can someone help ? See the example below. setClass("myclass", representation( name ="character" ) ) setGeneric("mymeth", function(obj, ...){ standardGeneric("mymeth") } ) setMethod("mymeth",
2011 Oct 22
1
setMethod "[" - extract by names within Slot
Hi R-helper! I have problem with setMethods for "[". Here is example : setClass("myClass", representation(ID.r = "numeric", ID.c = "character", DAT = "matrix")) to.myClass <- function(ID.r, ID.c, DAT) {     out <- new("myClass", ID.r = ID.r, ID.c = ID.c, DAT = DAT)     return(out)       }       setMethod("[",