From fparlamis at mac.com  Fri Oct  6 12:02:48 2006
From: fparlamis at mac.com (Parlamis Franklin)
Date: Fri, 6 Oct 2006 00:02:48 -1000
Subject: [Rd] class unions?
Message-ID: <EBA89392-7277-48CA-9AF8-F134D860C710@mac.com>

the code below has me confused:

	setClassUnion("index", c("numeric", "character", "logical"))
	extends("numeric") # i don't see the class union
	library(Matrix)
	extends("numeric") # now i see the class union

i am aware that the "Matrix" package separately defines the "index"  
class union.
is it the case that class definitions need to occur in packages?

i am also having trouble dispatching on class unions defined in the  
global environment,
which may just be the same problem. see code below:

	setClassUnion("numORchar", c("numeric", "character"))
	foo <- function(x) "Default"
	setMethod("foo", signature(x = "numORchar"),
		function(x) "numORchar")
	foo(2) # gives the default method

franklin

 > version
                _
platform       powerpc-apple-darwin8.7.0
arch           powerpc
os             darwin8.7.0
system         powerpc, darwin8.7.0
status
major          2
minor          4.0
year           2006
month          10
day            03
svn rev        39566
language       R
version.string R version 2.4.0 (2006-10-03)




[Rd] class unions?
Parlamis Franklin