From mtmorgan at fhcrc.org  Thu Sep 10 23:11:32 2009
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Thu, 10 Sep 2009 14:11:32 -0700
Subject: [Rd] importing/loading package without a namespace
In-Reply-To: <661590E4E3E64D87B2B6028BB04EBF98@headquarters.silicoinsights>
References: <661590E4E3E64D87B2B6028BB04EBF98@headquarters.silicoinsights>
Message-ID: <4AA96B84.4040904@fhcrc.org>

Hi Christos --

Christos Hatzis wrote:
> I am developing a package that imports some functions from another package.
> The imported package (qcc) does not have a namespace and this is causing
> problems with loading of my package, which has a namespace.  Is there a
> workaround to allow loading the namespace-less package?
> 
> I searched the archives and found a suggestion that the package should be
> included in the Depends list, but this has not helped.
> https://stat.ethz.ch/pipermail/bioc-devel/2007-April/001079.html
> 
> Thank you.
>  
> The contents of my DESCRIPTION file are:
>  
> Package: nvQC
> Type: Package
> ...
> Depends: R(>= 2.5.0), Biobase, qcc
> Imports: affy, RColorBrewer, affyio, nvNormalize
> Suggests: nvCELFiles
> LazyLoad: no
> LazyData: yes 
>  
> and those of the NAMESPACE file
> 
> export(nv.evalQC, gridQC, control.plots)
> import(qcc, affy)

If I understand, qcc does not have a name space, so you cannot import()
it. The best you can do is, as you have done, Depend: qcc. In your code,
you can be unambiguous about the functions you use

  qcc::someQccFunction(<etc>)

> importFrom(RColorBrewer, brewer.pal)
> importFrom(affyio, read.celfiles)
> importFrom(nvNormalize, norm.options)
> 
> The output from R CMD check nvQC 
> 
> * using log directory 'C:/Iatros01/Development/RPackages/nvQC/nvQC.Rcheck'
> * using R version 2.9.1 (2009-06-26)
> * using session charset: ISO8859-1
> * checking for file 'nvQC/DESCRIPTION' ... OK
> * checking extension type ... Package
> * this is package 'nvQC' version '1.0.0'
> * checking package name space information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking for .dll and .exe files ... OK
> * checking whether package 'nvQC' can be installed ... OK
> * checking package directory ... OK
> * checking for portable file names ... OK
> * checking DESCRIPTION meta-information ... OK
> * checking top-level files ... OK
> * checking index information ... OK
> * checking package subdirectories ... OK
> * checking R files for non-ASCII characters ... OK
> * checking R files for syntax errors ... OK
> * checking whether the package can be loaded ... ERROR
> Loading required package: Biobase
> 
> Welcome to Bioconductor
> 
>   Vignettes contain introductory material. To view, type
>   'openVignette()'. To cite Bioconductor, see
>   'citation("Biobase")' and for packages 'citation(pkgname)'.
> 
> Loading required package: qcc
> Error : package 'qcc' does not have a name space
> Error: package/namespace load failed for 'nvQC'
> Execution halted
> 
> It looks like this package has a loading problem: see the messages for
> details.
> 
> Christos Hatzis, Ph.D.
> Nuvera Biosciences, Inc.
> 400 West Cummings Park
> Suite 5350
> Woburn, MA 01801
> Tel: 781-938-3830
> www.nuverabio.com <http://www.nuverabio.com/>
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] importing/loading package without a namespace
Martin Morgan