Import one function into package R (no import)

I am writing an R package and I would like to use one function from another package ( plotKML ). This external package has so many dependencies that I do not want my users to load, etc. If I use importFrom(plotKML, readGPX) in the NAMESPACE file, it will load all plotKML into the namespace and load all the dependencies that I find I don't want.

So, the question arises: is it correct to copy the code for the function that I need (so that all the dependencies in this function are included)? If so, what is appropriate for attribution / documentation - will I copy the documentation from the original?

There is a big discussion on this issue in this post , and Brian Diggs answer is very helpful. But it ends with the words: β€œFor your example, you might be better off copying the code for memisc :: to describe in your package, although this approach has its problems and caveats,” so I remain with some uncertainty as to which problems and whether it is advisable to attribution point of view.

+5
source share
1 answer

Questions about appropriate attribution are likely to be best resolved by contacting the package author directly. As noted in the comments above, this package seems to use GPL-3, which should mean that you can include the feature in your package, but your package must also be licensed by GPL-3. (As always, probably no one here is a lawyer to check on you ...)

The primary disadvantage of copying only the function that you need is that then you are responsible for maintaining it. This probably also means keeping it in such a way that it synchronizes with the original version of plotKML . Depending on the package, the surrounding code, and how often it is updated, it can be pretty simple or it can be horrible.

+3
source

All Articles