You can make variables permanent using the pryr package.
install_github("pryr") library(pryr) xvar %<c-% 10 xvar
The %<c-% operator is a convenient wrapper for assign + lockBinding .
As the Baptist said in the comments: if you are having problems with this, this may be a sign of a bad coding style. Combining most of your logic into functions will reduce variable name conflicts.
Richie cotton
source share