One of my current tasks has a similar problem where I just want to see
the results of the function. I do something analogous to:
for(i in objects(pat='Apple.field')) print(myfun(get(i)))
It slightly complicates things if you want to assign the results. I would
do:
obj.in <- ls(pat="Apple.field")
obj.out <- paste(obj.in, "out", sep=".")
for(i in seq(along=obj.in)) assign(obj.out[i], myfun(get(obj.in[i])))
Patrick Burns
Burns Statistics
patrick@burns-stat.com
+44 (0) 208 525 0696
http://www.burns-stat.com/ (new home of S Poetry)
(and "A Guide for the Unwilling S User")
Steve Su wrote:
Dear All,
Is it possible to apply a function on several objects all at once?
I have a list of objects with names like
Apple.field.1
Apple.field.2
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|