In AllClasses.R I used

setClassUnion("cnmatrix", c("matrix"))

Sorry for the typo.

Venkat

On Thu, Aug 26, 2010 at 3:31 PM, Venkatraman Seshan <veseshan@gmail.com>wrote:

> Can the class definition in package "foo" be changed after the package is
> attached?  I am trying to do the following.
>
> The AllClasses.R file has the following class definitions.
>
> setClassUnion("mymatrix", c("mymatrix"))
> setClass("mydata", representation(x="numeric", y="cnmatrix"))
>
> In zzz.R the .onLoad has the following:
>
>   setHook(packageEvent("bigmemory", "attach"),
>           function(...){
>             setIs("big.matrix", "cnmatrix")
>             setClass("mydata", representation(x="numeric", y="cnmatrix")
>           })
>
> When I now do R CMD check pkg it is completed but I get a note
>
> * checking R code for possible problems ... NOTE
> Error in setIs("big.matrix", "cnmatrix") :
>   cannot create a 'setIs' relation when neither of the classes
> ("big.matrix" and "cnmatrix") is local and modifiable in this package
>
> How do I modify the definition of a class in a package?
>
> Thanks,
> Venkat
>
> My R.Version()
> $platform
> [1] "x86_64-pc-linux-gnu"
>
> $arch
> [1] "x86_64"
>
> $os
> [1] "linux-gnu"
>
> $system
> [1] "x86_64, linux-gnu"
>
> $status
> [1] ""
>
> $major
> [1] "2"
>
> $minor
> [1] "11.1"
>
> $year
> [1] "2010"
>
> $month
> [1] "05"
>
> $day
> [1] "31"
>
> $`svn rev`
> [1] "52157"
>
> $language
> [1] "R"
>
> $version.string
> [1] "R version 2.11.1 (2010-05-31)"
>
>

	[[alternative HTML version deleted]]

