This is in the help files for rm, but for non-unix-ians, it seems to be hard to remember. Normally, if I am testing code that should stand on it's own, perhaps that I'll send off to the R-help list or put on here, I'll run this before I send it off:
rm(list=ls())
This says remove the list of objects returned by ls, which returns what datasets and functions a user has defined. After running this, if you're code works, you know it will work in a clean environment. Several times I have almost "published" misspelled variables that seemed to be working because I had given the correct variable/function values while working through my thought-process. However, after starting from scratch, the misspelling appears immediately, discovered near the resulting error.