renozao / FAQR

Frequently Asked Questions on R: my personal Ask Just Once system for my friends' R problems...
0 stars 0 forks source link

Functions with the same name in R #8

Open Rachelly opened 9 years ago

Rachelly commented 9 years ago

Hi, I just ran into a stupid bug in my code, where 2 functions had the same name. I found that bug on run time and didn't get any warning about that when sourcing the files the functions were in. I guess when I sourced the file the second function just overrode the first one like it was any other variable...

How does compilation work in R? Is there any compilation at all? Is there a smart way of finding these mistakes before run-time?

Thanks, Rachelly.

renozao commented 9 years ago

R is not compiled but interpreted (although there are some bite-compilation possible/going on). I don't think there is a way to do that, and overriding the old function might be something the user actually want to do so... You just have to be careful :)