Skip to content
Prev 33676 / 398513 Next

S4 classes, creating in C

I don't believe the fact that you are doing this in C code is relevant
in this problem. 

If you define LUdecomposition as
 setClass("LUdecomposition", representation(a="matrix", pivot = "integer"),
                             prototype=list(pivot = NA)                    )


you will get an error if you simply type

  new("LUdecomposition")


To make this work,  define the class as

 setClass("LUdecomposition", representation(a="matrix", pivot = "integer"),
                             prototype=list(pivot = as.integer(NA)                    ))

Why the original does not work is because 
  typeof(NA) 
returns "logical".
So it is merely the type of the value that is the problem.

 HTH,
  Duncan
Douglas Bates wrote:

  
    
Message-ID: <20030623115346.C28506@jessie.research.bell-labs.com>
In-Reply-To: <6r65mwkdny.fsf@bates4.stat.wisc.edu>; from bates@stat.wisc.edu on Mon, Jun 23, 2003 at 10:37:53AM -0500