R/ma_exists.R

Defines functions ma_exists

Documented in ma_exists

## File Name: ma_exists.R
## File Version: 0.03

ma_exists <- function( x, pos, n_index=1:8)
{
    n_index <- n_index + 1
    is_there <- exists(x, where=pos)
    obj <- NULL
    nn <- 0
    if (is_there){
        obj <- get(x, pos)
    }
    if (! is_there){
        for (nn in n_index){
            pos <- parent.frame(n=nn)
            is_there <- exists(x, where=pos)
            if (is_there){
                obj <- get(x, pos)
                break
            }
        }
    }
    #--- output
    res <- list( is_there=is_there, obj=obj, pos=pos, n=nn)
    return(res)
}

Try the miceadds package in your browser

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

miceadds documentation built on May 29, 2024, 11:05 a.m.