[R] a question about frame
    ronggui 
    0034058 at fudan.edu.cn
       
    Wed Jun 15 18:09:05 CEST 2005
    
    
  
gg <- function(y) {
         ggg <- function() {
             cat("current frame is", sys.nframe(), "\n")
             cat("parents are", sys.parents(), "\n")
             print(sys.function(0)) # ggg
             print(sys.function(2)) # gg
         }
         if(y > 0) gg(y-1) else ggg()
     }
>  gg(3)
current frame is 5 
parents are 0 1 2 3 4 
function() {
             cat("current frame is", sys.nframe(), "\n")
             cat("parents are", sys.parents(), "\n")
             print(sys.function(0)) # ggg
             print(sys.function(2)) # gg
         }
<environment: 071C62FC>
function(y) {
         ggg <- function() {
             cat("current frame is", sys.nframe(), "\n")
             cat("parents are", sys.parents(), "\n")
             print(sys.function(0)) # ggg
             print(sys.function(2)) # gg
         }
         if(y > 0) gg(y-1) else ggg()
     }
my question is ,why the current frame is 5?why the sys.function is ggg.i am quite confused.
anyone can give me some clue?i have read the ?sys.parent,but i still can not get the point exactly.
 				
2005-06-16
------
Deparment of Sociology
Fudan University
Blog:www.sociology.yculblog.com
    
    
More information about the R-help
mailing list