Skip to content

[Bioc-devel] Creating a package, Error in match.arg(units)

10 messages · Sébastien Laigre, Martin Morgan, Patrick Aboyoun

#
S?bastien Laigre wrote:
Have you tried to start a new R session

   R --vanilla

and then source each of the files in the 'R' directory of the package, 
along the lines of

   fls = list.files("c:/base/MyApp/R", full=TRUE)
   for (f in fls) { cat(f, "\n"); source(f) }

? Or can you provide more information about where during the 
installation the error message is generated? Please also include 
sessionInfo().

Martin

  
    
#
Hi S?bastien --
S?bastien Laigre wrote:
it is not too hard to figure out how to load all the packages, e.g.,
following the sequence listed in the 00install.out output, below.
Perhaps it would help to review the manual 'Writing R Extensions' so
that you can get an understanding of what various files are?
Usually you want to do Rcmd build ... and then Rcmd check ....

Make sure that there are no 'hidden' files (starting with a '.') in any
of the folders in c:/base/MyApp/.

I don't really have other suggestions, other than to try to narrow down
where in your package the error occurs, e.g., by temporarily renaming
one file after the other in the MyApp/R directory.

Martin
#
S?bastien Laigre wrote:
Your own package should have a name space, and if you use functions from
Hmisc you should import just those

importFrom(Hmisc, foo, bar, baz)

If you are importing from Hmisc, then the DESCRIPTION file should have
Imports: Hmisc. If there are still problems, you can fully qualify the
symbols that you want

  base::units

It might be that there is still a problem, e.g., a third package that
does not have a name space but uses units, and so must find 'units' on
the search() path. In this case you must work around this by convincing
the third party author to use a name space, not use the third package,
or not use Hmisc.

Martin
4 days later
#
S?bastien Laigre wrote:
A better solution is to use a name space and 'importsFrom', for instance
in the DESCRIPTION file:

Imports: Hmisc

and in the NAMESPACE file

importFrom(Hmisc, someFunction, anotherFunction)

if you are not already using a name space, then I'd strongly encourage
you to use one. It'll help avoid conflicts like this in the future. Use
is documented in the 'Writing R extensions' manual.

Martin
#
S?bastien,
In addition to Martin's comments, copying code from Hmisc to your package could be a violation of Hmisc's license. As Martin's e-mail shows, importing symbols is a straight-forward process and is the recommended method in this situation.


Patrick
Martin Morgan wrote: