Re: [R] Testing for S4 objects

2004-11-30 Thread John Chambers
Let me suggest a different test, because slotNames was written to work differently when given a string or a class definition. With your definition, R x - classRepresentation R isS4object(x) [1] TRUE which I assume is not what you wanted. (Given a single string, slotNames() tries to look up

Re: [R] Reading Version 4 .sdd files

2004-10-05 Thread John Chambers
will not give you much of a clue without the definition of the class. Nor, for that matter, will the ordinary dump() output, but that at least may be re-executable, once you have the correct class definition. In either case, you would need to get the S-language definition of the class. John Chambers

Re: [R] debugging an S4 method

2004-09-07 Thread John Chambers
Bickel, David wrote: Does anyone know how to use the equivalent of debug() on an S4 method? I would like R to enter the browser not for the generic function, but for the method of the class that I specify. This is what the trace() function does, if you supply the signature= argument set to

Re: [R] as(obj,matrix)

2004-07-28 Thread John Chambers
, not r-help. John Chambers Eryk. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- John M. Chambers [EMAIL

Re: [R] Lazy Evaluation?

2004-06-08 Thread John Chambers
No, not lazy evaluation. The explanation has to do with environments and how callGeneric works. It's an interesting (if obscure) example. Here's the essence of it, embedded in some comments on debugging and on style. (This will be a fairly long discussion, I'm afraid.) A useful starting

Re: [R] privileged slots

2004-06-01 Thread John Chambers
the safer place to look for information. It is possible, but not very likely, that access lists might be revived if the underlying mechansim for slot access is changed. John Chambers Matthias Thanks, for your help Matthias Martin ___ R

Re: [R] Object validation and formal classes

2004-01-30 Thread John Chambers
It was never the intention that validity checking happen automatically on _every_ assignment of an object from the class--since those assignments take place frequently during evaluation of functions, the overhead would be unacceptable. And as Robert points out, one needs to postpone validity

Re: [R] setMethodReplace.. Help!

2004-01-29 Thread John Chambers
The error message says it: in R, the arguments for the generic function [ include i and j; the method definition must include those as well. Do getGeneric([) or ?[ to see the arguments. As has been said on the R mailing lists in the past, R is generally compatible with the published books,

Re: [R] Missing arguments to new

2003-12-19 Thread John Chambers
J Swinton wrote: Is this the expected and/or correct behaviour? And if so, how do I persuade new to interpret a named but missing argument as missing? The general problem you're having has to do with understanding ..., not with new(), but as it happens, there is a special mechanism for calls

Re: [R] setMethod(min, myclass, ...)

2003-12-03 Thread John Chambers
Thomas Stabla wrote: Hello, I have defined a new class setClass(myclass, representation(min = numeric, max = numeric)) and want to write accessor functions, so that for foo = new(myclass, min = 0, max = 1) min(foo) # prints 0 max(foo) # prints 1 At first i created a generic

Re: [R] conflicts(detail=TRUE)

2003-10-30 Thread John Chambers
methods defined in the package for assigning the body of special classes of functions. The version on the base package is not a generic. It's possible that in the future conflicts() might not report a generic vs a non-generic version of the same function, if they were compatible. John Chambers. R

Re: [R] How to make - generic?

2003-07-28 Thread John Chambers
the software calling some function or operator other than -, or using - in a special way (e.g., x - validObject(x) if validity checking was the goal). Regards, John Chambers Patrick Burns wrote: I think Brian's question --- what are you trying to do? -- should be the first order of business

Re: [R] S3 and S4 classes

2003-07-23 Thread John Chambers
.Object is exactly BECAUSE it expects user-defined arguments, in the ..., to start with a letter, and so chooses .Object to minimize the chance of conflicting.) Regards, John Chambers Duncan Murdoch __ [EMAIL PROTECTED] mailing list https

Re: [R] c(...) and methods

2003-06-11 Thread John Chambers
ordinary arguments. Not every example will work, but many will. John Chambers Marsland, John wrote: I have been writing some S4 classes and have a problem about how I might pass a signature to c(). Take the following example: setClass(collection, representation(list, date=POSIXt)) x

Re: [R] Missing 'getGroupMembers()'

2003-06-01 Thread John Chambers
. If there is a strong desire, the formal arguments could be changed, to function(x, ..., na.rm = FALSE). But this needs some discussion (preferrably on R-devel). John Chambers Anton __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman

Re: [R] 'methods' and [-

2003-03-03 Thread John Chambers
Laurent Gautier wrote: Dear List, I am trying to override the replace method [- for objects of class matrix... with little success... Would anyone know where I am wrong ? Not wrong at all. The problem is that matrix (and array) are implicit classes in R--there is no explicit class

Re: [R] interaction of options(error=) and try()

2003-01-07 Thread John Chambers
involve methods.) John Chambers luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City

Re: [R] Writing packages with `methods' package

2002-12-31 Thread John Chambers
() Regards, John Chambers Roger Peng wrote: I'm trying to write a package which uses classes/methods as defined in the `methods' package. I have a single .R file which defines the class and various methods for that class. At the top of the file I have require(methods