[R] Using library in an example

Jim Lemon jim at bitwrit.com.au
Thu Jun 5 11:58:14 CEST 2008

Thanks to Dirk and Duncan

Dirk's suggestion of the suppressMessages function unfortunately doesn't 
quite do the job. The warning message isn't printed, but it is picked up 
by the check function and leads to a whinge.

Duncan is right - I had an older version of "maps" and installing the 
new version fixed the problem that was causing the warning in the first 
place. (My apologies for not including sessionInfo).

So, the outcome is:

1) If you try to use require or library in help page examples, 
everything has to work.

2) If you use require or library, wrap it in 
suppressPackageStartupMessages so that the "Loading package" message 
doesn't mess up your elegant code.

3) Remember that 2) won't stop any errors or warnings from being 
recorded during package checking, therefore 1).

Is my logic sufficiently circular?


More information about the R-help mailing list