From pgilbert at bank-banque-canada.ca  Sun May  4 18:06:38 2008
From: pgilbert at bank-banque-canada.ca (Paul Gilbert)
Date: Sun, 04 May 2008 12:06:38 -0400
Subject: [Rd] S4 / S3 / Sweave problem
Message-ID: <481DDF0E.6060509@bank-banque-canada.ca>

I'm not sure if this as a bug or something I am doing wrong. It occurs 
in both 2.7.0 and 2.6.2.

require("methods")

setClassUnion("OptionalPOSIXct",   c("POSIXct",   "NULL"))

setClass("TSmetax",
   representation(serIDs="character", ExtractionDate="OptionalPOSIXct" ))

setGeneric("TSmetax",
    def= function(x, ...) standardGeneric("TSmetax"))

setMethod("TSmetax",   signature(x="character"),
    definition= function(x, ...){
        new("TSmetax", serIDs=x, ExtractionDate=Sys.time())
        } )

 > z <- new("TSmetax", serIDs="whatever", ExtractionDate= NULL)
 > print(z)
An object of class "TSmetax"
Slot "serIDs":
[1] "whatever"

Slot "ExtractionDate":
NULL

Now if I make this an attribute of an S3 class an print, I get
 > zz <- ts(1:10)
 > attr(zz, "Meta") <- z
 > print(zz)
Time Series:
Start = 1
End = 10
Frequency = 1
  [1]  1  2  3  4  5  6  7  8  9 10
attr(,"Meta")
<S4 Type Object>
attr(,"serIDs")
[1] "whatever"
attr(,"ExtractionDate")
`NULL`
attr(,"class")
[1] "TSmetax"
attr(,"class")attr(,"package")
[1] ".GlobalEnv"
 >

The `NULL` shows up i
  shows up in the tex file generated by a vignette as
<soh>NULL<soh> which causes  tex (pdftex) to throw an  error.
(It also seems to mess up my mail tool, so I hope this goes through.)

Paul
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential in...{{dropped:26}}



[Rd] S4 / S3 / Sweave problem
Paul Gilbert