[R] how to avoid to overwrite object

Gabor Grothendieck ggrothendieck at gmail.com
Thu Mar 8 00:02:57 CET 2007


Decompose your code into small understandable functions.

On 3/7/07, Aimin Yan <aiminy at iastate.edu> wrote:
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list