From ml-it-r-devel at epigenomics.com  Tue May 15 16:09:46 2007
From: ml-it-r-devel at epigenomics.com (ml-it-r-devel at epigenomics.com)
Date: Tue, 15 May 2007 16:09:46 +0200
Subject: [Rd] getNamespaceExports("base") error
In-Reply-To: <Pine.LNX.4.64.0705151305550.25495@auk.stats>
References: <f2c6sc$np8$1@perl.epigenomics.epi>
	<Pine.LNX.4.64.0705151305550.25495@auk.stats>
Message-ID: <f2cevb$6ku$1@perl.epigenomics.epi>

Prof Brian Ripley wrote:
> It would seem more logical to use x.  Today it has the 
> same contents as baseenv() (but a different enclosing env), but that may 
> change.
>
> I do wonder why you are using this: the R code clearly doesn't.  For 
> base is not a normal namespace and is automatically imported into every 
> other namespace (or similar words, as 'import' is used in a couple of 
> senses in the documentation).
I came across this programmatically applying getNamespaceExports to a 
vector of namespaces
where 'base' happend to be a member.

I will use  ls(.BaseNamespaceEnv, all=TRUE) instead .

Thank you!

   Matthias

> On Tue, 15 May 2007, ml-it-r-devel at epigenomics.com wrote:
> 
>>
>> Hi!
>>
>> >getNamespaceExports("base")
>> Error in ls(NULL, all = TRUE) : using 'as.environment(NULL)' is defunct
>>
>> getNamespaceExports
>> function (ns)
>> {
>>     ns <- asNamespace(ns)
>>     if (isBaseNamespace(ns))
>>         ls(NULL, all = TRUE)
>>     else ls(getNamespaceInfo(ns, "exports"), all = TRUE)
>> }
>> <environment: namespace:base>
>>
>> One possible way to fix this could be to changed to e.g.
>>
>> if (isBaseNamespace(ns))
>>   ls(envir=baseenv(), all = TRUE)
>>
>> Observed with
>> R 2.5.0  &  R 2.6.0 devel (2007-05-12 r41546)
>> (one has to go back to R 2.3.1 to see it working)
>>
>>
>> Regards,
>>
>>   Matthias
>>
>>
>>
> 


-- 
Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-371                          fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger at epigenomics.com
--
Epigenomics AG Berlin           Amtsgericht Charlottenburg HRB 75861
Vorstand:   Geert Nygaard (CEO/Vorsitzender),  Dr. Kurt Berlin (CSO)
               Oliver Schacht PhD (CFO),  Christian Piepenbrock (COO)
Aufsichtsrat:   Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)



[Rd] getNamespaceExports("base") error
ml-it-r-devel at epigenomics.com