I was about to ask another question on SO that this question popped up in my mind. How we define an object with a weird name. For instance, suppose we would like to call an object “test^#”. If I wanted to define it, I would use ” “:
"test^#" <- 10
Now the question is how to call this object?
If we again use ” “, then R considers it as a character string and not the name of an object.
While I see practical applications in being able to use symbols in the object names, but at this point it’s more a question out of my curiosity.
Thanks,
Use backticks:
Now use it:
You can also use backticks to refer to columns in data frames (or lists) with non-standard names. For example:
If you want to something really odd, like embedding backticks in the name, then you may have to use
get()to refer to it: