[Rd] inconsistency with names on call object

From: William Dunlap <wdunlap_at_tibco.com>
Date: Thu, 02 Feb 2012 19:54:11 +0000


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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 02 Feb 2012 - 20:00:31 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 03 Feb 2012 - 17:20:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive