I have a class defined as an extension to matrix:
fooCLASS <- setClass("foo",representation("matrix"))
and define a method for a generic function (no problem):
setMethod("diff",signature(x="foo"),diff.foo <-
function(x){x})
but I get a different behaviour for another generic function:
setMethod("lag",signature(x="foo"),lag.foo <-
function(x){x})
Error in assign(".packageName", pkg, env) :
can't add bindings to a locked environment
I did not get this behaviour under 1.5.1, it ran fine - any pointers?
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 1
minor 7.0
year 2003
month 04
day 16
language R
**********************************************************************
This is a commercial communication from Commerzbank AG.\ \ This ... {{dropped}}
Hello, this might be too much to ask, but just a thought... There are some efforts in the bioconductor area where people create functions to produce html tables which include links to current information. Would there be any chance that somebody can implement a similar functionality in the pdf device, so that you can not only create a graph but can also create a "clickable" graph with link to current information? Cheers, hinrich d8-)
On Wed, 21 May 2003, Heywood, Giles wrote:> I have a class defined as an extension to matrix: > fooCLASS <- setClass("foo",representation("matrix")) > > and define a method for a generic function (no problem): > setMethod("diff",signature(x="foo"),diff.foo <- function(x){x}) > > but I get a different behaviour for another generic function: > setMethod("lag",signature(x="foo"),lag.foo <- function(x){x}) > > Error in assign(".packageName", pkg, env) : > can't add bindings to a locked environment > > I did not get this behaviour under 1.5.1, it ran fine - any pointers?lag() is in package ts, which has a namespace these days. Why are you setting S4 methods on S3 generics? You will be able to set S3 methods.> lagfunction (x, ...) UseMethod("lag") <environment: namespace:ts>> difffunction (x, ...) UseMethod("diff") <environment: namespace:base> (and BTW the base namespace is somewhat different and not locked). The combination of S4 methods and namespaces is not supported, so if you need this you will need to define the S4 generic somewhere you own. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595