[Rd] Package Building and Name Space

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jan 24 16:25:54 CET 2008


On 1/24/2008 10:00 AM, Paul Gilbert wrote:
> I find the error message
> 
>  >>>>>Error in MyPackage::MyFunction :
> 
> is a bit misleading.  Could it be changed to
> 
>      Error in Package::Function

I believe "MyPackage" was either the actual name of the package, or what 
Johannes substituted for it.  But this whole thread would be a lot 
clearer if we had an actual reproducible example to look at, rather than 
a report of it that includes typos and substitutions.

> perhaps with a hint: "Possibly Package is not exporting a NAMESPACE."
> (At least, I think this does not work unless Package has a namespace.)

The message looked pretty clear to me, and agrees with the 
documentation.  For "::" to work, the package needs a namespace OR must 
be on the search path.  Apparently neither of those was true in this case.

Duncan Murdoch

> 
> Paul Gilbert
> 
> Johannes Graumann wrote:
>> On Wednesday 23 January 2008 18:24:15 Duncan Murdoch wrote:
>> 
>>>On 1/23/2008 11:31 AM, Johannes Graumann wrote:
>>>
>>>>On Wednesday 23 January 2008 17:25:38 Duncan Murdoch wrote:
>>>>
>>>>>On 1/23/2008 11:11 AM, Johannes Graumann wrote:
>>>>>
>>>>>>... sorry for reposting this in a more appropriate forum than
>>>>>>r.general ...
>>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>I just don't get this and would appreciate if someone could write a
>>>>>>line or two: I'm trying to build this package and it stops installing
>>>>>>after I add
>>>>>>
>>>>>>the following to the NAMESPACES file:
>>>>>>
>>>>>>>importFrom(gsubfn,strapply)
>>>>>>
>>>>>>The error during the package test is:
>>>>>>
>>>>>>Error in MyPackage::MyFunction :
>>>>>>  package 'MyPackage' has no name space and is not on the search path
>>>>>>Calls: <Anonymous> ... <Anonymous> -> switch -> sys.source -> eval ->
>>>>>>eval -> ::
>>>>>>Execution halted
>>>>>>
>>>>>>'MyFunction' contains 'strapply' from gsubfn.
>>>>>>
>>>>>>Please tell me where I err.
>>>>>
>>>>>The file is called NAMESPACE, not NAMESPACES.
>>>>
>>>>And that's what it's called here ... sorry for the typo above. The error
>>>>remains the same.
>>>
>>>With the obscuring you've done it's pretty hard to be sure, but I'd
>>>assume you have the expression MyPackage::MyFunction somewhere in your
>>>package, but MyPackage doesn't have a namespace.  In that case, you have
>>>to make sure it is attached via
>>>
>>>library(MyPackage)
>>>
>>>or
>>>
>>>require(MyPackage)
>>>
>>>before you can use the "::" operator.
>> 
>> 
>> But it's "mypackage" I'm trying to check ... can't attach that yet since I 
>> need to package and install it first ...
>> 
>> Joh
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> ====================================================================================
> 
> La version française suit le texte anglais.
> 
> ------------------------------------------------------------------------------------
> 
> This email may contain privileged and/or confidential information, and the Bank of
> Canada does not waive any related rights. Any distribution, use, or copying of this
> email or the information it contains by other than the intended recipient is
> unauthorized. If you received this email in error please delete it immediately from
> your system and notify the sender promptly by email that you have done so. 
> 
> ------------------------------------------------------------------------------------
> 
> Le présent courriel peut contenir de l'information privilégiée ou confidentielle.
> La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
> utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
> personne autre que le ou les destinataires désignés est interdite. Si vous recevez
> ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans délai à
> l'expéditeur un message électronique pour l'aviser que vous avez éliminé de votre
> ordinateur toute copie du courriel reçu.
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list