Q:

If exists in R using this

I want to see if a variable exists - i.e. that I have created in.
if(exists(this.mydict))
{ //append my dict
}else
{
// initialize dict
}

Trouble is this fails on 
Error in exists(this.mydict)

What am I doing wrong?
How can I extend the exists function to work with the following:
Any ideas how I would extend to this to looking at seeing whether a nested dictionary would also exist. I.e. for example: if(exists("mylists[[index]]['TSI']")), where the mylists object is a dictionary look up that also wants to contain a nested dictionary.

A:

exists() function takes a character argument with the variable name:
if(exists("this.mydict")){
    # you can use this.mydict here
}else{
    # initialize this.mydict
    # e.g. this.mydict <- "some value here"
}

