Skip to content

as.character methods

2 messages · McGehee, Robert, Brian Ripley

#
Hello,
?as.character says that the as.character function is a generic with
usage: as.character(x, ...). So, I want to create an S4 object with an
as.character method following the above usage, but I get the below error
telling me that ... isn't in the generic for as.character.
Error in rematchDefinition(definition, fdef, mnames, fnames, signature)
: 
	Methods can add arguments to the generic only if "..." is an
argument to the generic

Am I reading the documentation incorrectly? How do I correctly pass the
... object to the method for this "tmp" object?

However I note that looking at the generic function, I see no mention of
... (despite the documentation).
standardGeneric for "as.character" defined from package "base"

function (x) 
standardGeneric("as.character", .Primitive("as.character"))
<environment: 0145EDC4>
Methods may be defined for arguments: x 


So, briefly, is the documentation wrong? Am I doing something wrong? Can
I create an as.character method and pass additional arguments to it as I
think I should be able to?

Thanks,
Robert

Robert McGehee
Geode Capital Management, LLC
53 State Street, 5th Floor | Boston, MA | 02109
Tel: 617/392-8396    Fax:617/476-6389
mailto:robert.mcgehee at geodecapital.com



This e-mail, and any attachments hereto, are intended for use by the
addressee(s) only and may contain information that is (i) confidential
information of Geode Capital Management, LLC and/or its affiliates,
and/or (ii) proprietary information of Geode Capital Management, LLC
and/or its affiliates. If you are not the intended recipient of this
e-mail, or if you have otherwise received this e-mail in error, please
immediately notify me by telephone (you may call collect), or by e-mail,
and please permanently delete the original, any print outs and any
copies of the foregoing. Any dissemination, distribution or copying of
this e-mail is strictly prohibited.
#
You seem to be confusing `generic' with `S4 generic', and `method' with 
`S4 method'.

Note that all references to `generic' and `method' outside the `methods' 
package are not to S4 concepts unless explicitly stated.
On Thu, 13 Jan 2005, McGehee, Robert wrote:

            
Briefly, No, yes, yes.