On Sat, Mar 10, 2012 at 01:29:16PM -0800, casperyc wrote: > Hi all > > Say I have a function: > > myname=function(dat,x=5,y=6){ > res<<-x+y-dat > } > > for various input such as > > myname(dat1) > myname(dat2) > myname(dat3) > myname(dat4) > myname(dat5) > > how should I modify the 'res' line, to have new informative variable name > correspondingly, such as > > dat1.res > dat2.res > dat3.res > dat4.res > dat5.res > > stored in the workspace.
Why not keep the information of input values in a list, or vector? What is gained by storing that info in the variable _name_ ? Your function could return a list with both the result and the input value. While you did say that this was part of something complex, I suspect your post might be a case of "Being overly specific and not stating your real goal." -- Hans Ekbrand (http://sociologi.cjb.net) <h...@sociologi.cjb.net> ______________________________________________ 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.