[R] attaching data to any object

Patrick Burns pburns at pburns.seanet.com
Mon Nov 10 21:28:18 CET 2003


An alternative that might alleviate Uwe's scepticism:

Many functions such as the modelling functions have
a "call" component or attribute which is the result of

match.call()

within the function.  This makes the resulting object essentially
self-documenting.  I find it easier to write functions with the
returned object including "call" than to _accurately_ document
objects by hand.

In some settings the "call" can cause problems since it is a
language object.  This can be solved by using

deparse(match.call())

in place of the raw match.call call.


Patrick Burns

Burns Statistics
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Uwe Ligges wrote:

> Rajarshi Guha wrote:
>
>> Hi,
>>   is the following possible - in a given session I make a lot of objects
>> and save when exiting. Usually I note down seperately what each object
>> is about. Is it possible to attach data to any object which would
>> essentially be a short note explaining the meaning of it?
>
>
> You can add an attribute as in:
>
> x <- 1:10
> attributes(x) <- list(my.note = "This is a test")
>
> but I think it is not really what you are going to do...
>
> Uwe Ligges
>
>
>
>
>
>> Thanks,
>>
>> -------------------------------------------------------------------
>> Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
>> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
>> -------------------------------------------------------------------
>> The Heineken Uncertainty Principle:
>> You can never be sure how many beers you had last night.
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>




More information about the R-help mailing list