[R-pkg-devel] Help needed to setting custom packages for R 3.1.2

sbihorel Sebastien.Bihorel at cognigencorp.com
Wed Jul 15 15:07:37 CEST 2015


Hi,

I saw a few recent posts on topics related to mine (eg 
https://stat.ethz.ch/pipermail/r-package-devel/2015q3/000238.html). It 
looks like I need to import more packages in my NAMESPACE, correct?

However, I thought that imports would be recursive, ie imports would 
also get the info from dependent packages.

Sebastien


On 7/13/2015 9:42 PM, sbihorel wrote:
> Hi,
>
> Sorry about the table. It looked good when displayed using a fixed 
> width font. Let me try to linearize it:
>
>   * pkgA
>       o DESCRIPTION:
>           + Depends: methods, lattice, grid, gam
>           + Imports: Hmisc, survival
>       o NAMESPACE:
>           + import: lattice, grid, gam, methods
>           + importFrom: Hmisc (one function)
>   * pkgB
>       o DESCRIPTION:
>           + Depends: pkgA
>           + Imports: <nothing>
>       o NAMESPACE:
>           + import: pkgA
>           + importFrom: <nothing
>   * pkgC
>       o DESCRIPTION:
>           + Depends: methods, pkgB
>           + Imports: <nothing>
>       o NAMESPACE:
>           + import: methods, pkgB
>           + importFrom: <nothing
>
> Regarding the export, pkgA, pkgB, and pkgC NAMESPACE files include: 
> exportPattern("^[^\\.]").
>
> Sebastien
>
>
> On 7/13/2015 5:36 PM, Seth Wenchel wrote:
>> Are you exporting the functions from pkgB and pkgC? It's hard to tell 
>> from your table below. The easiest way is to add a comment before 
>> each of the functions in pkgB and pkgC that you want to expose to the 
>> users.
>>
>> #' @export
>> foo <- function(){...}
>>
>> Then run roxygen::roxygenise() to build the NAMESPACE file.
>>
>> HTH
>> Seth
>>
>> On Monday, July 13, 2015, sbihorel 
>> <Sebastien.Bihorel at cognigencorp.com 
>> <mailto:Sebastien.Bihorel at cognigencorp.com>> wrote:
>>
>>     Hi,
>>
>>     My group has recently upgraded from a fairly old R version (2.12)
>>     to the
>>     R version 3.1.2. In parallel to this upgrade, I am updating our
>>     custom
>>     packages to add functionality and also make them compliant to the
>>     requirements of the new version of R. I would like to ask your
>>     help with
>>     respect to warning messages I get when I check and install the
>>     packages.
>>     I read the latest version of the manual on writing R extensions,
>>     try to
>>     apply the recommendations, but somehow I am not getting things right.
>>     Hopefully, with your suggestions, I could setup my package
>>     correctly to
>>     make these messages stop.
>>
>>     I apologize but, for confidentiality purpose, I will have to
>>     partially
>>     anonymize the information.
>>
>>     So here is the situation: we have 2 custom packages (let's call them
>>     pkgB and pkgC). The pkgB package depends on a 3rd package (let's
>>     call it
>>     pkgA) that is available on CRAN. The pkgC package depends on
>>     pkgB, make
>>     new function available,  and "overwrites" some of the functions
>>     distributed as part of pkgA. The following table summarizes the
>>     content
>>     of the DESCRIPTION and NAMESPACE files of each of these packages.
>>
>>     package    DESCRIPTION NAMESPACE
>>                 Depends                       Imports
>>     import                         importFrom
>>     pkgA       methods, lattice, grid, gam   Hmisc, survival lattice,
>>     grid,
>>     gam, methods    Hmisc
>>     pkgB       pkgA pkgA
>>     pkgC       methods, pkgB methods, pkgB
>>
>>     I do not get any warning when I build, check or install pkgB in our
>>     linux openSuse environment.
>>
>>     After successful building pkgC, I run R CMD check on my built for
>>     pkgC
>>     but I get a ton of messages under the "checking R code for possible
>>     problems" section. These notes are related to actual calls to pkgA
>>     functions (or to one of the function provided by its
>>     dependencies). Here
>>     is a subset for illustration and hopefully information.
>>
>>     * checking R code for possible problems: NOTE
>>     pkgC_function_001: no visible global function definition
>>     for"pkgA_function_AAA"
>>     pkgC_function_001: no visible global function definition
>>     for"pkgA_function_AAB"
>>     ...
>>     pkgC_function_010: no visible global function definition for"xyplot"
>>     pkgC_function_010: no visible global function definition
>>     for"panel.xyplot"
>>     pkgC_function_010: no visible global function definition
>>     for"panel.abline"
>>     pkgC_function_010: no visible global function definition
>>     for"grid.polygon"
>>     pkgC_function_010: no visible global function definition for"gpar"
>>     ...
>>
>>     Now when I try to install the pkgC_0.0.1.tar.gz package, I get the
>>     following warnings about the content of my documentation Rd
>>     files. The
>>     Rd files of pkgC includes links to lattice, grid, or pkgA functions.
>>
>>     *** installing help indices
>>        converting help for package âkiwixposedevâ
>>          finding HTML links ... done
>>     pkgC_function_001                    html
>>          pkgC_function_002                    html
>>     ...
>>     Rd warning: /tmp/some/path/man/pkgC_function_009.Rd:21: missing file
>>     link "panel.abline"
>>     ...
>>     Rd warning: /tmp/some/path/man/pkgC_function_015.Rd:64: missing file
>>     link "pkA_function_AAC"
>>     ...
>>
>>     I think I need to somehow modify the content of the DESCRIPTION and
>>     NAMESPACE files for pkgC... but adding various combinations of
>>     pkA and
>>     its dependencies gave me others errors about redundancies and
>>     multiple
>>     loading of the same packages. So in short, I am kind of lost with the
>>     new requirements of R 3.1.2 and would greatly appreciate any help or
>>     suggestions
>>
>>     Thank you in advance for your time.
>>
>>     Sebastien Bihorel
>>
>>
>>             [[alternative HTML version deleted]]
>>
>>     ______________________________________________
>>     R-package-devel at r-project.org <javascript:;> mailing list
>>     https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list