R/util.R

Defines functions get.names

get.names  = function(o){  
  TAG    = list()
  TAGSTR = c()
    
  i      = 1
  NAMES  = names(o)
  for (name in NAMES) {
    e = o[[name]]
    if (is.list(e)){
      subNAMES = names(e)
      for (subname in subNAMES){
        #e1        = e[[subname]]     
        TAG[[i]]   = c(name,subname)
        TAGSTR[i]  = paste(name,subname,sep='$')   
        i  = i+1		
      }
    } else {      
      TAG[[i]]  = name
      TAGSTR[i] = name  
      i  = i+1	  
    }	
	
  }
  
  len = nchar(TAGSTR)
  idx = which(len==max(len))[[1]]
  x   = list(tag=TAG, tagstr=TAGSTR, maxstr=TAGSTR[idx])  
  invisible(x)
}

Try the Rbeast package in your browser

Any scripts or data that you put into this service are public.

Rbeast documentation built on May 31, 2023, 9:23 p.m.