Add code for work space cleaning

I am not an expert in R packages ... its my first contribution.

So if something is wrong or missing, please let me know.