[R] Doubt in relation with packaging

R. Michael Weylandt michael.weylandt at gmail.com
Tue Aug 21 03:54:36 CEST 2012


Rui's solution certainly works, but don't fear namespaces.

For a simple package, you basically just write

export(xxx)

for all the "main" functions and

import(yyy)

for all the packages yyy you use.

If you have S3 methods, it's also important to register those as

S3method(plot, zzz)

If you are providing a plot() method for a "zzz" object. This will
make them work, even if you don't export them.

There's much more you can do with them (in particular, the part on
"import" is way oversimplified), but this should cover the basics. The
manual "Writing R Extensions" covers all the complex things you can
do.

Cheers,
Michael

On Mon, Aug 20, 2012 at 7:31 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> I believe that the simplest way (the one I allways use) is to have the
> invisible functions' names start with a period.
>
> .aux <- function(x) #  user doesn't see it, R CMD check doesn't force .Rd
> file
>
> Hope this helps,
>
> Rui Barradas
> Em 20-08-2012 22:06, Eva Prieto Castro escreveu:
>
>> Hi,
>>
>> As I told you some days ago, finally I could build the package, but I have
>> one doubt: my source code has a lot of functions, but the users only need
>> some of them (the others are auxiliar functions), so there must be a way in
>> order to make invisibel the auxiliar functions. I think I can do it
>> adjusting NAMESPACES file (I don't known how to do it yet) but the question
>> is the following: auxiliar functions must be included in "man" folder? I am
>> refering to .Rd files, because I have to document them. There will be too
>> easy (marvellous) if I only need to include in "man" folder the main
>> functions, but not the auxiliar functions.
>>
>> I hope my explanation is correct.
>>
>> Regards.
>>
>> Eva
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list