[Rd] inconsistency with names on call object
William Dunlap
wdunlap at tibco.com
Thu Feb 2 20:54:11 CET 2012
With most sorts of objects the following three expression
have the same value:
names(obj)
attr(obj, "names")
attributes(obj)$names
However, for call objects the last gives NULL, whether there
are names or not.
> obj <- quote(func(one=1))
> obj
func(one = 1)
> names(obj)
[1] "" "one"
> attr(obj, "names")
[1] "" "one"
> attributes(obj)$names
NULL
I imagine that the underlying cause is that names are not
stored as other attributes are for call objects. Is is
just an oversight that attributes(call) does not include
a "names" component?
This can arise when using functions that recursively walk
through objects.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
More information about the R-devel
mailing list