[Rd] R CMD build: "Subdirectory 'R' contains invalid file names"

Kurt Hornik Kurt.Hornik at wu-wien.ac.at
Fri Feb 10 11:46:53 CET 2006

>>>>> Henrik Bengtsson writes:

> Hi, I get
> * excluding invalid files from 'R.oo'
> Subdirectory 'R' contains invalid file names:
>   attachLocally.Object.Rex Exception.Rex extend.default.Rex
>   InternalErrorException.reportBug.Rex Package.Rex Person.Rex Rdoc.Rex
>   setMethodS3.Rex StaticFields.Rex

> when running R CMD build in R v2.3.0 devel.  I do understand what is
> going on.  In my *.R files I keep so called Rdoc comments which in
> their simplest form are Rd code wrapped up in plain comments.  These
> are compiled into Rd files written to ../man/ (I do this prior to
> building packages).  Rdoc also supports inclusion of other files, e.g.
> @include "Person.Rex" to include example code.

> With this structure I can, when I develop/maintain a package, have
> <pkg>/R/ as the working directory, modify my *.R files and re-source
> them from within R.  Since I keep all my Rd example code in separate
> *.Rex files, I can easily rerun/test these by sourcing them too.  I
> find this very convenient.

> In previous versions, the *.Rex files was included when building a
> source distribution of a package.  In R v2.3.0 they are excluded. 
> However, I would like to distribute the *.Rex files with my
> source-code package too (so I do not have to keep another type of
> source distribution).  Note that these files are only needed for
> further development of the package, but *not* to install the package
> from source (since their contents is already incorporated in the Rd
> files).  They are also not of interest to the end-user.


I am not sure I fully understand the issue.


   Note that these files are only needed for further development of the

suggests that these files are only needed for your local master sources,
but not in the source package created by R CMD build.  If this is the
case, then you really don't have to do anything, because R CMD build
will happily exclude these files, and R CMD check on the .tar.gz will no
longer find them.


> My question is how to incorporate the *.Rex files?  Here are some
> ideas, that I would like to have some feedback on:

> 1) Put them in <pkg>/R/Rex/*.Rex.  However, Section 1.1.4 in Writing R
> Extensions suggest that subdirectories of R/ may only(?) be named
> 'windows' or 'unix'.

> 2) Rename them to <pkg>/R/*.in, cf. Section 1.1.4.  Is this the
> purpose of *.in files?  Will it have side effects?

> 3) Put the in <pkg>/inst/<dir>/*.Rex.  This will work, but then they
> will also be install and available in system.file("<dir>",
> package="<pkg>").  Not a big problem, but not what I want.

> 4) To avoid (3), put the in <pkg>/<dir>/*.Rex, i.e. at the top level
> directory.  Is this allowed?  Section 1.1.4 says "Note that [...]
> information files at the top level of the package will not be
> installed". Does this mean that they will be included in the source
> distribution and what about top level directories?

> 5) Put the in <pkg>/src/*.Rex.  Can src/ be used this way too?

> 6) Ask R-core to revert back to pre-R v2.3.0 and allow other files in
> the R/ directory too.  Are more people than I interested in this?

> I realize I can test the above by trial and error, but I will still
> not be sure what is the right approach here.  Comments/feedback is
> appreciated.

> Thanks

> Henrik

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list