"Jens Oehlschlägel"
2007-Nov-05 12:41 UTC
[Rd] namespace crash on S3method("as.ff",function)
Dear all, I have defined a generic as.ff(x, ...) and a method as.ff.function(x, ...) which converts a standard R function x into a chunked version operating on large ff objects. Everything works fine, but when registering S3method("as.ff",function) in NAMESPACE, the installation fails with some kind of parsing error: adding build stamp to DESCRIPTION installing NAMESPACE file and metadata Fehler in parse(nsFile) : Unerwartetes ')' bei 348: 349: S3method("as.ff",function) Calls: <Anonymous> -> parseNamespaceFile -> parse Ausf?hrung angehalten make[2]: *** [nmspace] Error 1 make[1]: *** [all] Error 2 make: *** [pkg-ff] Error 2 *** Installation of ff failed *** Is this a bug? Any ideas? Best regards Jens P.S. with as.ff() we can do things like ffx <- as.ff(x) # as.ff.default() turns a standard R object into an ff object stored on disk as.ff(log)(ffx) # as.ff.function() turns 'log' into a function that we can call on ffx: taking the log of an almost arbitrarily large object> version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 6.0 year 2007 month 10 day 03 svn rev 43063 language R version.string R version 2.6.0 (2007-10-03) -- Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
On 11/5/2007 7:41 AM, Jens Oehlschl?gel wrote:> Dear all, > > I have defined a generic as.ff(x, ...) and a method as.ff.function(x, ...) which converts a standard R function x into a chunked version operating on large ff objects. Everything works fine, but when registering > > S3method("as.ff",function) > > in NAMESPACE, the installation fails with some kind of parsing error: > > adding build stamp to DESCRIPTION > installing NAMESPACE file and metadata > Fehler in parse(nsFile) : Unerwartetes ')' bei > 348: > 349: S3method("as.ff",function) > Calls: <Anonymous> -> parseNamespaceFile -> parse > Ausf?hrung angehalten > make[2]: *** [nmspace] Error 1 > make[1]: *** [all] Error 2 > make: *** [pkg-ff] Error 2 > *** Installation of ff failed *** > > Is this a bug? Any ideas?"function" is a reserved keyword for the parser. Even though you don't execute a NAMESPACE file, it's parsed by the standard parser, and that's causing the problem. (You couldn't have a function call that looked like that without a parse error, either.) I don't have time to explore this today, but what I'd do is try S3method("as.ff", `function`) or S3method("as.ff","function") first, and if those don't fix it and you don't get a better suggestion, then report this as a design bug. Duncan Murdoch> Best regards > > > Jens > > > P.S. with as.ff() we can do things like > ffx <- as.ff(x) # as.ff.default() turns a standard R object into an ff object stored on disk > as.ff(log)(ffx) # as.ff.function() turns 'log' into a function that we can call on ffx: taking the log of an almost arbitrarily large object > > >> version > _ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 6.0 > year 2007 > month 10 > day 03 > svn rev 43063 > language R > version.string R version 2.6.0 (2007-10-03) >
Prof Brian Ripley
2007-Nov-05 13:42 UTC
[Rd] namespace crash on S3method("as.ff",function)
On Mon, 5 Nov 2007, "Jens Oehlschl?gel" wrote:> Dear all, > > I have defined a generic as.ff(x, ...) and a method as.ff.function(x, ...) which converts a standard R function x into a chunked version operating on large ff objects. Everything works fine, but when registering > > S3method("as.ff",function) > > in NAMESPACE, the installation fails with some kind of parsing error: > > adding build stamp to DESCRIPTION > installing NAMESPACE file and metadata > Fehler in parse(nsFile) : Unerwartetes ')' bei > 348: > 349: S3method("as.ff",function) > Calls: <Anonymous> -> parseNamespaceFile -> parse > Ausf?hrung angehalten > make[2]: *** [nmspace] Error 1 > make[1]: *** [all] Error 2 > make: *** [pkg-ff] Error 2 > *** Installation of ff failed *** > > Is this a bug? Any ideas?You need to quote "function". It falls under (Note that variable names may be quoted, and non-standard names such as @code{[<-.fractions} must be.) since reserved words cannot be standard names. But it could stand being spelt out in R-exts. There are examples in package 'utils'. -- 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