From murdoch at stats.uwo.ca  Thu Jan 24 16:25:54 2008
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Thu, 24 Jan 2008 10:25:54 -0500
Subject: [Rd] Package Building and Name Space
In-Reply-To: <4798A82A.7020003@bank-banque-canada.ca>
References: <fn7ov3$2d6$1@ger.gmane.org>	<200801231731.00579.johannes_graumann@web.de>	<4797783F.1020309@stats.uwo.ca>	<200801231907.57881.johannes_graumann@web.de>
	<4798A82A.7020003@bank-banque-canada.ca>
Message-ID: <4798AE02.4020103@stats.uwo.ca>

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



[Rd] Package Building and Name Space
Duncan Murdoch