Hi, So now R CMD check starts to warn against :::, but I believe sometimes it is legitimate to use it when developing R packages. For example, I have some utils functions that are not exported but I want to share them across the packages that I maintain. I do not need to coordinate with other authors about these internal functions since I'm the only author and I know clearly what I'm doing, and I want to avoid copying and pasting the code across packages just to avoid the NOTE in R CMD check. What should I do in this case? Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Web: http://yihui.name Department of Statistics, Iowa State University 102 Snedecor Hall, Ames, IA
On 22.08.2013 07:45, Yihui Xie wrote:> Hi, > > So now R CMD check starts to warn against :::, but I believe sometimes > it is legitimate to use it when developing R packages. For example, I > have some utils functions that are not exported but I want to share > them across the packages that I maintain. I do not need to coordinate > with other authors about these internal functions since I'm the only > author and I know clearly what I'm doing, and I want to avoid copying > and pasting the code across packages just to avoid the NOTE in R CMD > check. What should I do in this case?Nothing. The way you describe above seems to be a reasonable usage, iff you are the same maintainer who knows what is going on. Other maintainers should not use one of your not exported (hence non API) functions, of course. Uwe Ligges> > Regards, > Yihui > -- > Yihui Xie <xieyihui at gmail.com> > Web: http://yihui.name > Department of Statistics, Iowa State University > 102 Snedecor Hall, Ames, IA > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Hi, related to this important discussion I have several questions: What can I do to explicitly state that I want to use a certain, *non-exported* generic function? The function I am currently talking of is predict.smooth.spline from package stats. As I want to make shure that *this* function is used I currently call stats:::predict.smooth.spline() in my code, which now triggers a NOTE on CRAN. Strange enough predict.smooth.spline even has a manual page but is not exported (as is true for many other generic functions as well). Is it advisable to specify (S3) methods without exporting them? How can I access exactly this function without using :::? And/or shouldn't we (R Core in this instance but others - including myself) export all methods (especially if a manual exists anyway)? A related question concerns the function stats:::n.knots. I want to use this function to compute the number of knots for a spline (not necessarily a smoothing spline as defined by smooth.spline were it is originally used). The source of the function even states as a comment: "## Namespace-hidden but at least available to programmeRs:" So I guess this function can be considered to be stable and usable. Would it then be possible for R Core to export this function? Finally, if one needs to copy a function (perhaps with minor modifications), how does one properly state the authorship of the code that one copies? Are there any guidelines, rules, ...? Is it sufficient for small functions to state the original authorship as a comment in the source? Is it necessary to state the authorship in the manual? Or is it even required to state the quthorship in the DESCRITPION? I already did an extensive search of the R-devel mailing list but couldn't find an appropriate answer. And after all I do not want to spend hours and hours thinking about licenses, authorship etc. but I want to produce nice and usable code (but also want to mention the original authors appropriately)! Happy to learn more and read your thoughts and ideas about these issues. All the best, Benjamin