[R] a weird question about gdata:::

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon Dec 5 02:07:37 CET 2011


I prefer to think of namespaces as preventing clashes with similarly-named functions in the main workspace or in other packages that might serve a different need.

Given that purpose, I don't think I would have confined that particular function behind the namespace, because any other use of that name is likely to duplicate the functionality of that particular function, and any improvements to it probably ought to be incorporated into that particular function just as much as any other implementation would deserve improvement.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Gabor Grothendieck <ggrothendieck at gmail.com> wrote:

>On Sun, Dec 4, 2011 at 6:57 PM, Rolf Turner <rolf.turner at xtra.co.nz>
>wrote:
>>
>> See end of message.
>>
>>
>> On 05/12/11 10:19, Erin Hodgess wrote:
>>>
>>> Dear R People:
>>>
>>> If I put in:
>>>
>>>> findPerl
>>>
>>> Error: object 'findPerl' not found
>>>
>>>
>>> But if I use:
>>>
>>>> gdata:::findPerl
>>>
>>> function (perl, verbose = "FALSE")
>>> {
>>>     errorMsg<- "perl executable not found. Use perl= argument to
>>> specify the correct path."
>>>     if (missing(perl)) {
>>>         perl = "perl"
>>>     }
>>>     perl = Sys.which(perl)
>>>     if (perl == "" || perl == "perl")
>>>         stop(errorMsg)
>>>     if (.Platform$OS == "windows") {
>>>         if (length(grep("rtools", tolower(perl)))>  0) {
>>>             perl.ftype<- shell("ftype perl", intern = TRUE)
>>>             if (length(grep("^perl=", perl.ftype))>  0) {
>>>                 perl<- sub("^perl=\"([^\"]*)\".*", "\\1",
>perl.ftype)
>>>             }
>>>         }
>>>     }
>>>     if (verbose)
>>>         cat("Using perl at", perl, "\n")
>>>     perl
>>> }
>>> <environment: namespace:gdata>
>>> Why does one work but not the other, please?
>>
>>
>> Because "findPerl" is ``not exported'' from the gdata namespace.
>>
>> Uhhh, what does that mean?  I have a vague idea, but I'm not
>sufficiently
>> confident/competent to elaborate.  You'll just have to read up on
>> namespaces.
>> I'm *sure* namespaces are really a Good Thing, but they sure do add
>to the
>> mysteries of R usage.
>>
>
>The idea is to divide objects into those that are there for the user
>to access (exported objects) and those that are internal objects that
>only the package itself uses (everything else).   findPerl is there
>only so that read.xls and other routines that depend on perl scripts
>can use it internally to find perl.  It was not intended that users
>access it so its better hidden from view.
>
>-- 
>Statistics & Software Consulting
>GKX Group, GKX Associates Inc.
>tel: 1-877-GKX-GROUP
>email: ggrothendieck at gmail.com
>
>______________________________________________
>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.



More information about the R-help mailing list