On Mon, Jun 15, 2009 at 12:38 PM, Payam Minoofar <
payam.minoo...@meissner.com> wrote:

> ...I would like to have a function acquire an object by reference, and
> within the function create new objects based on the original object and then
> use the name of the original object as the base for the names of the newly
> created objects.
>
> It seems to me that the optimal way of doing this is to have the function
> acquire the name of the object as a string, and then use get() to access the
> object, and then to use the same string to do the name formation of the new
> objects....


Instead of creating new names through string manipulation, I'd think it
would be cleaner and simpler to use the list mechanism to return a
structured object, e.g.

ddd <- function (obj) list( new1 = makenew1(obj), new2 = makenew2(obj), new3
= makenew3(obj) )

Then you'd write, e.g.

   ddx <- ddd(oldobj)
   ddx$new1            <<< names new1

Perhaps this will work for you....

          -s

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to