Juan Carlos Borrás
2011-Jun-28 13:38 UTC
[R] A masked function is a masked function by any other name
Dear all, It looks like I do not grasp the concept of masked functions enough as to solve this trivial problem. The code that replicates the problem (a source code tree that realizes a R package actually) is under github so one can call it clone it easily from the command line (though more experienced users will spot the problem by browsing through the package code): git clone http://jcborras at github.com/jcborras/rseedpkg.git rseedpkg builds and installs with the usual sequence: R CMD build rseedpkg R CMD INSTALL rseedpkg_0.01-1.tar.gz Last but not least one can test it from the command line: Rscript --verbose --default-packages=testthat,log4r -e "test_package('rseedpkg')" The thing is that if one changes the call log4r:::debug() to plain debug() in R/f1.r and R/f2.r then one ends up calling base:::debug() and not log4r:::debug() even though the former should be masked by the later as log4r is a package dependency of my dummy rseedpkg. And that's something that I cannot understand... Thanks in advance jcb!
Duncan Murdoch
2011-Jun-28 13:42 UTC
[R] A masked function is a masked function by any other name
On 28/06/2011 9:38 AM, Juan Carlos Borr?s wrote:> Dear all, > It looks like I do not grasp the concept of masked functions enough as > to solve this trivial problem. > The code that replicates the problem (a source code tree that realizes > a R package actually) is under github so one can call it clone it > easily from the command line (though more experienced users will spot > the problem by browsing through the package code): > git clone http://jcborras at github.com/jcborras/rseedpkg.git > > rseedpkg builds and installs with the usual sequence: > R CMD build rseedpkg > R CMD INSTALL rseedpkg_0.01-1.tar.gz > > Last but not least one can test it from the command line: > Rscript --verbose --default-packages=testthat,log4r -e > "test_package('rseedpkg')" > > The thing is that if one changes the call log4r:::debug() to plain > debug() in R/f1.r and R/f2.r then one ends up calling base:::debug() > and not log4r:::debug() even though the former should be masked by the > later as log4r is a package dependency of my dummy rseedpkg. And > that's something that I cannot understand...If you are using ::: (three colons), then you may be looking into the unexported functions in log4r. The only normal way to see unexported functions is to use three colons. Duncan Murdoch
Juan Carlos Borrás
2011-Jun-28 15:47 UTC
[R] A masked function is a masked function by any other name
Ops! Thank-you Duncan for clarifying the 2 vs. 3 colon difference and a couple of other things. Working like a charm now. Cheers, jcb!> If you are using ::: (three colons), then you may be looking into the > unexported functions in log4r. ?The only normal way to see unexported > functions is to use three colons. > > Duncan Murdoch >