Exists {lazy.tools}R Documentation

Check If the Objects Listed Exist in the Parent Frame

Description

Check If the Objects Listed Exist in the Parent Frame

Usage

Exists(
  varname,
  ntogoback = 1,
  mode = c("numeric", "character", "logical"),
  get = 0,
  debug = 0
)

Arguments

varname

A string vector containing object names

ntogoback

n for parent.frame

mode

A string vector containing what to look for.

get

= 1 to retrieve the value of those objects.

debug

= 1 to print intermediate results

Value

If get=0:
ex A vector indicating the existence of each object.
If get=1:
A list of ex and a list, value, which contains the values of the objects found.

Examples

a=0; b=0; c=0; d=0; e=0
rm(a,b,c,d,e)

a="A0"
b="B0"
d=function(a){print(a)}
Exists( varname=c("a","b","c","d","e") )
Exists( varname=c("a","b","c","d","e"), get=1 )
Exists( varname=c("a","b","c","d","e"), get=1, mode="function" )

func1 <- function(){
 a="A1"
 b="B1"
 res=Exists( varname=c("a","b"), get=1 )
 Print(res)
 res=Exists( varname=c("a","b"), get=1, ntogoback=2 )
 Print(res)
}
func1()



[Package lazy.tools version 0.1.4 ]