[Rd] S4 / S3 / Sweave problem

Paul Gilbert pgilbert at bank-banque-canada.ca
Sun May 4 18:06:38 CEST 2008


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}}



More information about the R-devel mailing list