R-alpha: R0.16 class loss

Paul Gilbert (la-jassine@aix.pacwan.net)
Sat, 08 Feb 1997 04:39:43 -0400


Date: Sat, 08 Feb 1997 04:39:43 -0400
To: R-testers@stat.math.ethz.ch
From: Paul Gilbert <la-jassine@aix.pacwan.net>
Subject: R-alpha: R0.16 class loss

There seems to be some problem with objects losing their class attribute
when methods are applied, under some circumstances I haven't been able to
isolate very well. The following example was not problem in 0.15.

R : Copyright 1997, Robert Gentleman and Ross Ihaka
Version 0.16  (Released: February 7, 1997)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "license()" for details.

> v1 <- list(input = matrix(c(0, 0.25, 1.8), 3, 1))
> "input.series.names<-" <- function (x, name) 
     UseMethod("input.series.names<-", x, name)
> "input.series.names<-.TSdata" <- function (x, name) 
     {x$input.names <- name
      x
     }
> class(v1) <- "TSdata"
> class(v1) 
[1] "TSdata"
> input.series.names(v1) <- "R90"
>  class(v1) 
NULL
> #  this should still be class "TSdata"


Paul Gilbert

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-