[Rd] S4 / S3 / Sweave problem

From: Paul Gilbert <pgilbert_at_bank-banque-canada.ca>
Date: Sun, 04 May 2008 12:06:38 -0400


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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 04 May 2008 - 17:23:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 04 May 2008 - 19:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive