[R] How to pack my stuff into a package (library, collection)?

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Apr 8 13:19:24 CEST 2008

Tribo Laboy wrote:
> Thanks all for the help and suggestions. I am little by little finding
> my way. I have another question to the people who use the R packaging
> system. Say I have a function called "myfun.R". Where am I supposed to
> write the help to that function? When I use promt("myfun") or
> package.skeleton("myfun") I get a skeleton of the .Rd file which
> contains both help and R source. 

The R source in the Rd file is there instead of an example, you should 
replace it.
Note that Rd stands for R documentation, it should not include code 
sources, just documentation sources.

> What do you do with the original .R
> source file then - do you delete it? I suppose it is not necessary

No, it must be there in the package sources, otherwise you won't have 
any functions in your package.

Uwe Ligges

> anymore and all changes to R source and help can be done
> simultaneously in the .Rd file. Then it can be used to generate all
> the help and R files to be run. But then .Rd files cannot be run
> directly from R, so each time a change is done to the source, it must
> be re-exported in an .R file and run. Please tell me if I am wrong. Do
> you keep R-souce and R-help in separate files while developing and
> then combine them in a single .Rd file when you're finished?
> Yours still confused,
> TL
> On Mon, Apr 7, 2008 at 3:13 PM, Tribo Laboy <tribolaboy at gmail.com> wrote:
>> Hello,
>>  I am new useR, I have written some functions, which I currently use by
>>  "source"-ing them from the files.
>>  That's OK, but when I my functions start counting in the tens and
>>  hundreds I'd be glad to be able to type
>>  "help.search("my_obscure_fun")" and get a sensible reply. I also want
>>  to be able to load them as a package at startup and not have to
>>  "source" each one individually. I read through the "Writing R
>>  Extensions" file, but I am overwhelmed with the vast amount of
>>  prescribed detail that Extension Authors must follow - directory
>>  structure, file structure, etc. Luckily, I found the "prompt"
>>  function, which helps in writing of help-files in the form of "fill-in
>>   the blanks". But that's only for the help-files. Reading further, it
>>  gets even more complicated. The user is referred to the "R
>>  Installation and Administration" document, which says that:
>>  If you want to build R or add-on packages from source in Windows, you
>>  will need to collect, install and test an extensive set of tools.
>>  These seem to include among others Perl and compiler. But R is an
>>  interpreted and cross-platform language, I don't understand the need
>>  for additional platform specific tools just to call a user collection
>>  of R-files. Anyone knows of a smooth introduction to these topics?
>>  Rgards,
>>  TL
> ______________________________________________
> 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