R/getObj.R

Defines functions getObj

Documented in getObj

#'
#'@title Get an object from a list object using the specified path into the list
#'
#'@description Function to get an object from a list object using the specified path into the list.
#'
#'@param path - path in the list to the desired object (using '/' as separator for list levels)
#'@param lst - the list to extract the object from
#'@param verbose - flag (T/F) to print diagnostics
#'
#'@return the specified object, or NULL if not found
#'
#'@details none.
#'
#'@export
#'
getObj<-function(path,lst,verbose=FALSE){
    if (verbose) cat("Getting object at '",path,"'\n",sep='')
    lvls<-strsplit(path,"/",fixed=TRUE);
    obj<-tryCatch(lst[[lvls[[1]]]],error=function(e){NULL;});
    return(obj);
}
wStockhausen/rTCSAM02 documentation built on April 16, 2024, 6:25 a.m.