From oscar.perpinan at upm.es  Wed Jan 27 11:01:55 2010
From: oscar.perpinan at upm.es (Oscar =?UTF-8?B?UGVycGnDsWFu?= Lamigueiro)
Date: Wed, 27 Jan 2010 11:01:55 +0100
Subject: [Rd] Depends, Suggests and .First.lib
Message-ID: <20100127110155.79d660b5@upm.es>

Dear all,

I am working in the development of a package with more or less 25 functions. Most of them do not have dependencies on other extra packages. However, I am including three GUIs for the most important functions of the package. These three GUIs need the gWidgets package. Moreover, there is another function which makes use of latticeExtra and latticedl. 
Since these three packages are not needed for successfully load my package I understand, following the guidelines of "Writing R Extensions", that they do not need to be included under "Depends" but under "Suggests". But I am including the GUIs as a help for those people who are reluctant to the use of a console, so I would prefer these dependencies to be loaded automatically. Therefore I have written a zzz.R with this .First.lib function:

.First.lib <- function(lib, pkg){	
 require(vcd, quietly = TRUE)
 if (!require(lattice, quietly = TRUE)) 
   warning('lattice package could not be loaded. Some 
   funcionalities may not be available')
 if (!require(latticedl, quietly = TRUE)) 
  warning('latticedl package could not be loaded. Some
  funcionalities may not be available')
 if (!require(latticeExtra, quietly = TRUE)) 
  warning('latticeExtra package could not be loaded. Some
  funcionalities may not be available')
 if (!(require(gWidgets, quietly = TRUE) && 
    (require(gWidgetstcltk, quietly = TRUE) || require(gWidgetsRGtk2, quietly = TRUE))))
    warning('gWidgets package or their associated packages could not be loaded. GUI funcionalities will not be available')
}
Perhaps it is better and easier to include these packages in "Depends" but I am not sure. I would appreciate your advice.

Another question is about the load of data. I am including two datasets which are used by two functions. They are small (about 6kB). Is it better to use LazyData:no or insert a data() inside the code of these two functions?

Thank you very much for your help.

Best regards.

Oscar Perpi??n Lamigueiro
Dpto. de Ingenier?a El?ctrica
EUITI-UPM



[Rd] Depends, Suggests and .First.lib
Oscar =?UTF-8?B?UGVycGnDsWFu?= Lamigueiro