[R] Name of frame

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Mar 11 13:46:20 CET 2010


On Thu, Mar 11, 2010 at 12:30 PM, Tom Backer Johnsen
<backer at psych.uib.no> wrote:
> Is it possible to get hold of the name of a frame?
>

I can't see a direct way, but you could capture the output of print:

 > framename=function(frame){capture.output(print(frame))}
 > foo=function(x){framename(sys.frame(1))}
 > foo()
 [1] "<environment: 0x8eb451c>"

any good?

Barry



More information about the R-help mailing list