Skip to content
Prev 24925 / 63424 Next

Problem calling $ inside a $ method

In x$name, 'name' is supposed to be a symbol, unevaluated, or a 
literal character string (but not a character vector).
[1] 1
NULL

illustrates your misunderstanding.

Note that the S4 generic for $ in fact is

"$" = function(x, name)
{
     name <- as.character(substitute(name))
     standardGeneric("$")
}

so within S4 dispatch you will have a character vector for 'name'.
You need substitute() to get back to a literal character string.

I think the latter should be documented somewhere, but like many details 
of S4, it is not AFAIK.
On Mon, 7 May 2007, Seth Falcon wrote: