[R] Why do not prevent users from creating a local copy of c() ?

Joshua Wiley jwiley.psych at gmail.com
Sun May 29 22:00:50 CEST 2011


Hi Marco,

I am sure theoretically it would be possible to make it so that copies
could not be made of base (or core) functions, but users will always
be able to shoot themselves in the foot if they try hard enough.  I
think the usual recommendation is just not to use common function
names for your own functions/data.

If you write scripts instead of just directly using the console, you
do not need to save the workspace, which mitigates a whole slew of
potential things you did at some prior time and have long since
forgotten biting you in the posterior.  You can still save data, but
by using clean sessions, you are more aware of what has been done.

Cheers,

Josh

On Sun, May 29, 2011 at 12:20 PM, Marco Barbàra <jabbba at gmail.com> wrote:
> Hi all,
>
> sometime in the past I accidentaly created a copy of the c()
> primitive function inside my ``laboratory'' workspace, which I
> normally use to experiment and learn. As a consequence, c() stopped to
> work correctly and started to return lists of symbols instead of
> vectors, and today I had to spend much time to seek out that the problem
> was in that specific workspace (if only I had known in advance ... ).
>
> The weird thing is that if I now recreate a local copy of c(), the
> function does continue to work correctly.
>
> Anyway, my question is: could be possible to prevent users from doing
> such dangerous things?
>
> Thanks, Marco.
>
> ______________________________________________
> R-help at r-project.org 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list