[R-pkg-devel] duplicate function during build
Sven E. Templer
sven.templer at gmail.com
Sat Jul 23 08:09:21 CEST 2016
Not during build, but before, you could run in a bash from the package source root:
$ awk '/function/{print $1}' R/* | uniq -d
To find the files, use:
$ grep <name> R/*
Best wishes,
Sven
> On 23 Jul 2016, at 05:01, ProfJCNash <profjcnash at gmail.com> wrote:
>
> In trying to rationalize some files in a package I'm working on, I
> copied a function from one file to another, but forgot to change the
> name of one of them. It turns out the name of the file containing the
> "old" function was later in collation sequence than the one I was
> planning to be the "new" one. To debug some issues, I put some print()
> and cat() statements in the "new" file, but after building the package,
> they weren't there. Turns out the "old" function got installed, as might
> be expected if files processed in order. Debugging this took about 2
> hours of slightly weird effort with 2 machines and 3 OS distributions
> before I realized the problem. It's fairly obvious that I should expect
> issues in this case, but not so clear how to detect the source of the
> problem.
>
> Question: Has anyone created a script to catch such duplicate functions
> from different files during build? I think a warning message that there
> are duplicate functions could save some time and effort. Maybe it's
> already there, but I saw no obvious message. In this case, I'm only
> working in R.
>
> I've found build.R in the R tarball, which is where I suspect such a
> check should go, and I'm willing to prepare a patch when I figure out
> how this should be done. However, it seems worth asking if anyone has
> needed to do this before. I've already done some searching, but the
> results seem to pick up quite different posts than I need.
>
> Cheers, JN
>
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list