Displaying 3 results from an estimated 3 matches for "listornull".
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 work
#defining a union class it works with list and null
setClassUnion("listOrNULL", c("list", "NULL"))
setClass("c1", representation(value =...
2010 Jan 24
1
recursive data-structures in R - An S4 "node" Class
...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 am trying to define corresponding S4 class. The closest I could come was:
setClassUnion("listOrNULL",members=c("list", "NULL"))
setClass(Class = "Inode", representation(c =
"numeric",n="numeric",nodes="listOrNULL"))
This does not work, as setting an element of the list of nodes in a node
object overwrites the original object. I hav...
2009 Mar 09
5
Help
...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 work
>
> #defining a union class it works with list and null
> setClassUnion("listOrNULL", c("list", "NULL"))
> setClass("...