[R] attaching data to any object

Ulrich Flenker uli at biochem.dshs-koeln.de
Mon Nov 10 16:31:51 CET 2003


On 10 Nov 2003, 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?
> 
> Thanks,
 

Rajarshi,

the following does what you want. I don't know whether its generally a 
good idea to do the documentation of your data this way.

> X <- data.frame(x=1:10,y=1:0)

> X
    y  x
1   1  1
2   2  2
3   3  3
4   4  4
5   5  5
6   6  6
7   7  7
8   8  8
9   9  9 
10 10 10

> attr(X,"note") <- " Rajarshi's dummy data"

> X
    x  y
1   1  1
2   2  2
3   3  3
4   4  4
5   5  5
6   6  6
7   7  7
8   8  8
9   9  9
10 10 10

> attr(X,"note")

[1] " Rajarshi's dummy data"




--
	Uli Flenker

	Institute of Biochemistry
	German Sport University Cologne
	Carl-Diem-Weg 6
	50933 Cologne

	Phone 0049/221/4982-506




More information about the R-help mailing list