[R] how to avoid to overwrite object

Aimin Yan aiminy at iastate.edu
Wed Mar 7 22:26:53 CET 2007


Dear R list,
I have a question in R, it could be very simple, but I don't know how to do it?

for example:
I assign 6 to x in beginning of of my R script code
 > x<-6
......
After many line code, I forget using x variable before, I use x 
again, and do assignment like this
 > x<-45
 > x
[1] 45

then value 6 of previous x is replaced by 45.

I am wondering if there are some way R can give me warning like
"x is used before, overwrite it or not?" when I use x again?

Thanks,

Aimin



More information about the R-help mailing list