In the previous section we saw how you can write a function to be shared with other users. If you want to share a whole bunch of functions with other people, you can consider creating your own R package.
Writing an R extension package has several advantages even if it is not published in a public repository. It allows you to distribute and re-use a set of functions that can be installed on any system that has an R installation. An R package also allows you to hide all sorts of messy functions that are not useful to the user of your package—you can choose which functions are seen by your users and which are not. Functions not seen by the users are for the package's internal use. For example, you could write a function called
discriminant(a,b,c),
in the example of the previous section that the user of the
abc
function never needs to be aware of.
Packages have a fairly extensive mandatory documentation system that requires that every parameter of every function...