My objective is to start having meta-data on objects that I create.
For example, consider the following function:

assign2 <- function(x, ...)
{
 assign("x", ...)
attr(x, "creation time") <- Sys.time()
 x <<- x
}

assign2("x", 1:4)

"assign2" assigns to x the vector 1:4, and it then also adds the creation
time of the object.

(Hat tip goes to Peter Alspach for pointing me to the concept of adding meta
data to an object using attr)


But this function has several major limitations:
1) It will not work for any assignment other then "x".  For example
assign2("y", 1:4)
Doesn't work.
How might this be fixed ?
2) This function will probably need to also search the parent environment if
the variable already exists.  If it does, then there should be a "update
date" instead of "creation date".  But for that to work, I'll need a
solution for problem 1.
3) How will this handle a case when we are updating only a subset of the
items?  (for example:  assign2("x[1:2]", 8:9) )
4) My real intention is to somehow change the "<-" operator (not simply the
assign).  I am unsure as to how to do that.
5) Are there any major pros/cons to the adding of such meta-data to objects?
(for example, excessive overhead on memory/performance)
6) Is there already some system that knows how to do this in R (which I am
simply ignorant about)?

Thanks for following through, and for any suggestions/thoughts you might
have.

Best,
Tal





----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

	[[alternative HTML version deleted]]

