saikat@stat.wisc.edu
2003-Oct-09 17:17 UTC
[Rd] S4 group generic Complex not working (PR#4483)
The Complex group generic for S4 methods is not working: > setClass('foo', representation(z='complex')) [1] "foo" > setMethod('Complex', 'foo', function(z) callGeneric(z@z)) [1] "Complex" > Arg(new('foo', z=1+0i)) Error in Arg(new("foo", z = 1 + (0+0i))) : non-numeric argument to function > The fix is to add if (DispatchGroup("Complex", call, op, args, env, &x)) return x; near the beginning of do_cmathfuns in complex.c. --please do not edit the information below-- Version: platform = i686-pc-linux-gnu arch = i686 os = linux-gnu system = i686, linux-gnu status major = 1 minor = 8.0 year = 2003 month = 10 day = 08 language = R Search Path: .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, Autoloads, package:base
Prof Brian Ripley
2003-Oct-09 18:46 UTC
[Rd] S4 group generic Complex not working (PR#4483)
On Thu, 9 Oct 2003 saikat@stat.wisc.edu wrote:> The Complex group generic for S4 methods is not working: > > > setClass('foo', representation(z='complex')) > [1] "foo" > > setMethod('Complex', 'foo', function(z) callGeneric(z@z)) > [1] "Complex" > > Arg(new('foo', z=1+0i)) > Error in Arg(new("foo", z = 1 + (0+0i))) : > non-numeric argument to function > >> The fix is to add > > if (DispatchGroup("Complex", call, op, args, env, &x)) > return x; > > near the beginning of do_cmathfuns in complex.c.I don't think that's right: that would set up an S3 group generic Complex, and there is no such thing. That's not how S4 group generics are implemented, according to ?Complex. -- Brian D. Ripley, ripley@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