Skip to content

PATCH: Add fields argument to installed.packages and available.packages

36 messages · Martin Maechler, Paul Gilbert, Pfaff, Bernhard Dr. +6 more

Messages 1–25 of 36

#
Hi all,

The write_PACKAGES function has a 'fields' argument that allows a user
generating a PACKAGES file to specify additional fields to include.
For symmetry, it would be nice for the available.packages function to
be able to read those extra fields when specified.

Similarly, it would be useful for installed.packages to have a
'fields' argument.  This would allow a user to query the set of
installed packages for other fields in the DESCRIPTION file.

One use for this would be for repository hosters to include the
License field in their PACKAGES file.  In this way, end users could
query a repository and only download packages that they have a license
to use.

Below is a patch against svn 38996 that attempts to implement this.

+ seth


Index: src/library/utils/R/packages.R
===================================================================
--- src/library/utils/R/packages.R	(revision 38996)
+++ src/library/utils/R/packages.R	(working copy)
@@ -1,5 +1,6 @@
 available.packages <-
-    function(contriburl = contrib.url(getOption("repos")), method)
+    function(contriburl = contrib.url(getOption("repos")), method,
+             fields = NULL)
 {
     .checkRversion <- function(x) {
         if(is.na(xx <- x["Depends"])) return(TRUE)
@@ -9,10 +10,14 @@
         else TRUE
     }
 
-    flds <- c("Package", "Version", "Priority", "Bundle",
-              "Depends", "Imports", "Suggests", "Contains")
-    res <- matrix(as.character(NA), 0, length(flds) + 1)
-    colnames(res) <- c(flds, "Repository")
+    requiredFields <- c("Package", "Version", "Priority", "Bundle",
+                        "Depends", "Imports", "Suggests", "Contains")
+    if (!is.null(fields) && is.character(fields))
+      fields <- unique(c(requiredFields, fields))
+    else
+      fields <- requiredFields
+    res <- matrix(as.character(NA), 0, length(fields) + 1)
+    colnames(res) <- c(fields, "Repository")
     for(repos in contriburl) {
         localcran <- length(grep("^file:", repos)) > 0
         if(localcran) {
@@ -23,7 +28,7 @@
                 if(length(grep("[A-Za-z]:", tmpf)))
                     tmpf <- substring(tmpf, 2)
             }
-            res0 <- read.dcf(file = tmpf, fields = flds)
+            res0 <- read.dcf(file = tmpf)
             if(length(res0)) rownames(res0) <- res0[, "Package"]
         } else {
             dest <- file.path(tempdir(),
@@ -57,7 +62,7 @@
                             call. = FALSE, immediate. = TRUE, domain = NA)
                     next
                 }
-                res0 <- read.dcf(file = tmpf, fields = flds)
+                res0 <- read.dcf(file = tmpf)
                 if(length(res0)) rownames(res0) <- res0[, "Package"]
                 .saveRDS(res0, dest, compress = TRUE)
                 unlink(tmpf)
@@ -65,7 +70,14 @@
             } # end of download vs cached
         } # end of localcran vs online
         if (length(res0)) {
-            res0 <- cbind(res0, Repository = repos)
+            missingFields <- fields[!(fields %in% colnames(res0))]
+            if (length(missingFields)) {
+                toadd <- matrix(as.character(NA), nrow=nrow(res0),
+                                ncol=length(missingFields),
+                                dimnames=list(NULL, missingFields))
+                res0 <- cbind(res0, toadd)
+            }
+            res0 <- cbind(res0[, fields], Repository = repos)
             res <- rbind(res, res0)
         }
     }
@@ -307,22 +319,29 @@
 }
 
 installed.packages <-
-    function(lib.loc = NULL, priority = NULL,  noCache = FALSE)
+    function(lib.loc = NULL, priority = NULL,  noCache = FALSE,
+             fields = NULL)
 {
     if(is.null(lib.loc))
         lib.loc <- .libPaths()
-    pkgFlds <- c("Version", "Priority", "Bundle", "Contains", "Depends",
-                 "Suggests", "Imports", "Built")
     if(!is.null(priority)) {
         if(!is.character(priority))
             stop("'priority' must be character or NULL")
         if(any(b <- priority %in% "high"))
             priority <- c(priority[!b], "recommended","base")
     }
-    retval <- matrix("", 0, 2+length(pkgFlds))
+    requiredFields <- c("Version", "Priority", "Bundle", "Contains",
+                        "Depends", "Suggests", "Imports", "Built")
+    if (!is.null(fields) && is.character(fields))
+      fields <- unique(c(requiredFields, fields))
+    else
+      fields <- requiredFields
+    retval <- matrix("", 0, 2+length(fields))
     for(lib in lib.loc) {
         dest <- file.path(tempdir(),
-                          paste("libloc_", URLencode(lib, TRUE), ".rds",
+                          paste("libloc_", URLencode(lib, TRUE),
+                                paste(fields, collapse=","),
+                                ".rds",
                                 sep=""))
         if(!noCache && file.exists(dest) &&
             file.info(dest)$mtime > file.info(lib.loc)$mtime) {
@@ -332,12 +351,12 @@
             ## this excludes packages without DESCRIPTION files
             pkgs <- .packages(all.available = TRUE, lib.loc = lib)
             for(p in pkgs){
-                desc <- packageDescription(p, lib = lib, fields = pkgFlds,
+                desc <- packageDescription(p, lib = lib, fields = fields,
                                            encoding = NA)
                 ## this gives NA if the package has no Version field
                 if (is.logical(desc)) {
-                    desc <- rep(as.character(NA), length(pkgFlds))
-                    names(desc) <- pkgFlds
+                    desc <- rep(as.character(NA), length(fields))
+                    names(desc) <- fields
                 } else {
                     desc <- unlist(desc)
                     Rver <- strsplit(strsplit(desc["Built"], ";")[[1]][1],
@@ -352,7 +371,7 @@
             }
         }
     }
-    colnames(retval) <- c("Package", "LibPath", pkgFlds)
+    colnames(retval) <- c("Package", "LibPath", fields)
     if(length(retval) && !is.null(priority)) {
         keep <- !is.na(pmatch(retval[,"Priority"], priority,
                               duplicates.ok = TRUE))
Index: src/library/utils/man/installed.packages.Rd
===================================================================
--- src/library/utils/man/installed.packages.Rd	(revision 38996)
+++ src/library/utils/man/installed.packages.Rd	(working copy)
@@ -7,7 +7,7 @@
 }
 \usage{
 installed.packages(lib.loc = NULL, priority = NULL,
-                   noCache = FALSE)
+                   noCache = FALSE, fields = NULL)
 }
 \arguments{
   \item{lib.loc}{
@@ -21,6 +21,11 @@
     assigned priority use \code{priority = "NA"}.
   }
   \item{noCache}{Do not use cached information.}
+
+  \item{fields}{a character vector giving the fields to extract from
+    each package's \code{DESCRIPTION} file in addition to the default
+    ones, or \code{NULL} (default).  Unavailable fields result in
+    \code{NA} values.}
 }
 \details{
   \code{installed.packages} scans the \file{DESCRIPTION} files of each
@@ -31,18 +36,21 @@
   for versioned installs with the name under which the package is
   installed, in the style \code{mypkg_1.3-7}.
 
-  The information found is cached (by library) for the \R session,
-  and updated only if the top-level library directory has been altered,
-  for example by installing or removing a package.  If the cached
-  information becomes confused, it can be refreshed by running
-  \code{installed.packages(noCache = TRUE)}.
+  The information found is cached (by library) for the \R session and
+  specified \code{fields} argument, and updated only if the top-level
+  library directory has been altered, for example by installing or
+  removing a package.  If the cached information becomes confused, it
+  can be refreshed by running \code{installed.packages(noCache =
+  TRUE)}.
 }
 \value{
   A matrix with one row per package, row names the package names and
   column names \code{"Package"}, \code{"LibPath"}, \code{"Version"},
-  \code{"Priority"}, \code{"Bundle"}, \code{"Contains"}, \code{"Depends"},
-  \code{"Suggests"}, \code{"Imports"} and \code{"Built"}
-  (the \R version the package was built under).
+  \code{"Priority"}, \code{"Bundle"}, \code{"Contains"},
+  \code{"Depends"}, \code{"Suggests"}, \code{"Imports"} and
+  \code{"Built"} (the \R version the package was built under).
+  Additional columns can be specified using the \code{fields}
+  argument.
 }
 \seealso{
   \code{\link{update.packages}}, \code{\link{INSTALL}}, \code{\link{REMOVE}}.
@@ -50,5 +58,6 @@
 \examples{
 str(ip <- installed.packages(priority = "high"))
 ip[, c(1,3:5)]
+plic <- installed.packages(priotiry = "high", fields="License")
 }
 \keyword{utilities}
Index: src/library/utils/man/update.packages.Rd
===================================================================
--- src/library/utils/man/update.packages.Rd	(revision 38996)
+++ src/library/utils/man/update.packages.Rd	(working copy)
@@ -20,7 +20,7 @@
                 type = getOption("pkgType"))
 
 available.packages(contriburl = contrib.url(getOption("repos")),
-                   method)
+                   method, fields = NULL)
 
 old.packages(lib.loc = NULL, repos = getOption("repos"),
              contriburl = contrib.url(repos),
@@ -157,7 +157,14 @@
     This is sometimes used to perform additional operations at the end
     of the package installation in addition to removing intermediate files.
   }
+  \item{fields}{a character vector giving the fields to extract from
+    the \code{PACKAGES} file(s) in addition to the default ones, or
+    \code{NULL} (default).  Unavailable fields result in \code{NA}
+    values.
+  }
 }
+
+}
 \details{
   All of these functions work with the names of a package or bundle (and
   not the component packages of a bundle, except for
@@ -252,7 +259,8 @@
   with one row per package/bundle, row names the package names and
   column names \code{"Package"}, \code{"Version"}, \code{"Priority"},
   \code{"Bundle"}, \code{"Depends"}, \code{"Imports"}, \code{"Suggests"}
-  \code{"Contains"} and \code{"Repository"}.
+  \code{"Contains"} and \code{"Repository"}.  Additional columns can
+  be specified using the \code{fields} argument.
 
   For \code{old.packages}, \code{NULL} or a matrix with one row per
   package/bundle, row names the package names and column names
#
Seth> Hi all, The write_PACKAGES function has a 'fields'
    Seth> argument that allows a user generating a PACKAGES file
    Seth> to specify additional fields to include.  For
    Seth> symmetry, it would be nice for the available.packages
    Seth> function to be able to read those extra fields when
    Seth> specified.

    Seth> Similarly, it would be useful for installed.packages
    Seth> to have a 'fields' argument.  This would allow a user
    Seth> to query the set of installed packages for other
    Seth> fields in the DESCRIPTION file.

    Seth> One use for this would be for repository hosters to
    Seth> include the License field in their PACKAGES file.  In
    Seth> this way, end users could query a repository and only
    Seth> download packages that they have a license to use.

    Seth> Below is a patch against svn 38996 that attempts to
    Seth> implement this.

I like the idea and will look into applying the patch
(note there's at least one typo which makes "make check" fail:
 /priotiry/)

A propos:

A while back (in last summer?), we (some of R-core) have
discussed about a new field to be added to DESCRIPTION,
and AFAIR, the only problem we had, is to find a name we
all liked.
Or was there more then the name alone, and some where convinced
that it is superfluous and hence too complicated.

The idea was a field related to but weaker than 'Suggests' :
Something like
     'canMakeUseOf: <pkg1> [, <pkg2>, ... ]
which is *not* used in any QA/QC checking, but is purely
informative: If <pkg1> is require()able, then some examples may
look nicer, a function may provide another feature, etc, etc.
Alternatives to 'canMakeUseOf' would have been
'isHappilyCoworkingWith' ....

What do you (R-devel listeners) think about the idea?

Martin
#
Martin Maechler wrote:

            
I still like this idea.  I prefer 'canMakeUseOf' to 
'isHappilyCoworkingWith'  mainly because it seems less ambiguous.

Paul Gilbert
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}
#

        
PaulG> Martin Maechler wrote:
>> ...
    >> 
    >> The idea was a field related to but weaker than 'Suggests' :
    >> Something like
    >> 'canMakeUseOf: <pkg1> [, <pkg2>, ... ]
    >> which is *not* used in any QA/QC checking, but is purely
    >> informative: If <pkg1> is require()able, then some examples may
    >> look nicer, a function may provide another feature, etc, etc.
    >> Alternatives to 'canMakeUseOf' would have been
    >> 'isHappilyCoworkingWith' ....
    >> 
    >> What do you (R-devel listeners) think about the idea?

    PaulG> I still like this idea.  I prefer 'canMakeUseOf' to 
    PaulG> 'isHappilyCoworkingWith'  mainly because it seems less ambiguous.

Thanks, Paul.
As you may have guessed I should have put a  " :-) "  beside the
'isHappily...' .

Of course, even 'CanMakeUseOf' {we should capitalize the first letter}
is rather too long, but before finding the proper term, we should
agree on usefulness of such a new field.
Apart from the use of package authors {some could note that
other packages make use of theirs, without already depending on
or suggesting them}, it's one of those fields that should help
in the future to explore (e.g. cluster or neighborhood-graph)
the growing high-dimensional space of R packages.

Martin
#
Hello Martin, hello Paul,

this is an interesting iniative! There are already 'task views' (I do
not have to tell you :-); with a growing number of packages contained in
each) and hence, the 'value added', IMHO, of such a field in the
DESCRIPTION file would be to narrow down the search to affiliated
packages. Incidentally, these packages might not be contained in a
certain task view and the advantage is threefold: first this give
package authors the leeway to decide which packages should go 'hand in
hand' with their one(s); secondly, users might be pointed to packages,
that would have slipped their attention by only spotting at a certain
task view and last but not least, not all packages do appear in a task
view. 

Just my 2c.

Best,
Bernhard
*****************************************************************
Confidentiality Note: The information contained in this mess...{{dropped}}
#
Martin Maechler <maechler at stat.math.ethz.ch> writes:
Great.  Sorry for the typo, I've sent an update privately.
Some thoughts:

* Beyond strict dependencies, it is useful for a package to be able to
  declare that it "can use" other packages to provide additional
  features _which may be platform specific_.

* It is useful to be able to check the non-optional parts when
  non-essential packages are not available.  In the case of platform
  specific optional features, this is essential.  Otherwise it would
  be impossible to ever run check.

* Package vignettes, used heavily in Bioconductor, often require a set
  of packages to be available to provide data and functions for a
  coherent example analysis.  These extra packages are often not used
  directly by the package itself (neither dependency nor "can use").
  A similar issue arises for examples included in package
  documentation.

* It is useful to be able to check only those vignettes and examples
  where the required packages available.

* If I were a new user/developer coming to R and read about Depends,
  Suggests, and CanMakeUseOf, I would likely be confused.

With that in mind, I wonder if:

  Suggests could mean "can use" and a compromise of some sort be
  established w.r.t. to R CMD check (similar to --no-vignettes).

  Depends.examples (or similar) be added which lists dependencies for
  documentation examples and vignettes.  

Best Wishes,

+ seth
#
Rather than a plethora of fields, perhaps the Depends field could indicate
what depends on the object:  For example, if we use file extensions to
indicate what is dependent then one might write this to indicate that
some .Rd (i.e. examples) and .Rnw (i.e. vignette) files depend on lattice
and the entire package depends on zoo and the package is related to
but not dependent on tseries:

Depends: lattice (.Rd, .Rnw), grid (.Rnw), zoo, tseries (0)

Then there could be rules for each such suffix when processing
the package.

This has the advantage that its meaning is more obvious than a bunch
of keywords (Depends, Suggests, CanUse, Related).
On 8/29/06, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
#
On 8/29/2006 10:12 AM, Martin Maechler wrote:
I think we need an option to R CMD check rather than a new field in the 
DESCRIPTION.  Currently a package could be mentioned for any of these 
reasons:

1.  To make functions, examples or vignettes work
2.  To allow optional functionality in functions, examples or vignettes.
3.  Because it contains complementary functions.

I don't think we really need to worry about 3:  it should be contained 
in 1 or 2, if reasonably complete examples are given.

Case 1 is handled by Depends.

An author should check case 2 both with and without the suggested 
package.  A user  might be satisfied with a simple check "as things 
currently stand", or might want a stringent check like the author wants. 
  The author can't know that, because it will depend on the user.

So I don't think this is something that should be changed in 
DESCRIPTION.  There should be an option to R CMD check to include or 
exclude packages mentioned in the Suggests entry.  (I'd suggest a 3 
level option:  check as though they are not available, check as 
currently installed, require that they be available.)

Duncan Murdoch
#
Duncan Murdoch <murdoch at stats.uwo.ca> writes:
I think there is an important distinction between a dependency needed
for the package to function and a dependency needed to demonstrate
said functionality via an example or vignette.  The former is what
Depends is about, the latter is something else (Suggests).
I like this approach and agree in general that a solution involving
changes to R CMD check might be the best as opposed to adding fields.

+ seth
#
On 8/29/2006 11:58 AM, Seth Falcon wrote:
Yes, that's a good point, especially with vignettes.  Only the package 
author needs to be able to run them.

But maybe examples should be considered broken if they don't work. Users 
should be able to expect example(foo) not to generate an error.  Package 
authors should wrap optional examples in code like if (require(...)).

Duncan Murdoch
#
Duncan Murdoch wrote:

            
Well, from "Writing R Extensions"
   The optional  Suggests  field uses the same syntax as  Depends  and 
lists packages that are not
   necessarily needed. This includes packages used only in examples or 
vignettes

So case 1 is handled by the combination of Depends and Suggests, and we 
need something to handle case 2.

The related question is whether the CRAN checks should  try to check 2, 
or perhaps there needs to be 2a and 2b.  There are cababilities (and 
data) that CRAN may not have, so it would be nice distinguish things 
that should be checked on CRAN from things that should not be.

Paul
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}
#
On 8/29/2006 1:05 PM, Paul Gilbert wrote:
Yes, Seth pointed that out too.  Rather than adding additional levels, 
I'd fix it by changing the wording:

1.  To make functions work.
2.  To make examples and vignettes work, or optional functionality in 
functions.

The point is that there are some packages that are absolutely required 
(listed in Depends), and some that are only sometimes required (listed 
in Suggests).  Gabor's suggestion of labelling how things are used could 
be helpful too, but really even there, there are multiple levels of how 
something is used.
I'd suggest that CRAN do its checks using the "as currently installed" 
option proposed below.  If a package can't pass tests using what's on 
CRAN, then it should be marked as needing work.

Duncan Murdoch
#
Duncan Murdoch <murdoch at stats.uwo.ca> writes:
Yes, but just to keep things clear: the value of vignettes is that
users can follow along.  So the ability to programatically identify
the extra required packages is valuable.
I agree.  As with vignettes, there is value in users being able to
follow along and it would be nice to have a programatic way to
identify extra package needed for fancy/involved/optional examples.

Best,

+ seth
#
Seth Falcon wrote:

            
This is a work around that is ok for the developer's testing and to 
prevent failure on CRAN, and I use it. But, other than actually reading 
the examples, it provides no hints to other testers or users about 
things that might be installed, or installed first, to give more 
complete testing and more functionality.

Looking toward the future, I think it would be useful to have a standard 
mechanism to indicate extensions that are available in a package, and 
might be tested and used, but are not necessarily available on CRAN. For 
instance, an example might access to a purchased database or take 
advantage of  a computer cluster. It seems limiting to think that all 
testing that cannot be done on CRAN must be done almost exclusively by 
the developer.

Paul
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}
#
On 8/29/2006 2:24 PM, Paul Gilbert wrote:
I'm not saying to use this instead of Suggests, I'm saying to do both. 
This way the Suggests entries really are suggestions:  the examples will 
run with or without the presence of the suggested packages.

I think there are so many variations on when a Suggested package should 
be installed, that it's not reasonable to expect to be able to encode 
them all in a machine readable way.  They should be documented in human 
readable format.
If by "mechanism" you mean human-readable documentation, I agree with 
this.

Duncan Murdoch
#
Duncan Murdoch wrote:

            
Yes,  I was think of human-readable and in a standard location, like a 
field in the DESCRIPTION file.  (You are thinking of fields in the 
DESCRIPTION file as human-readable, are you not?)

Paul
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}
#
On 8/29/2006 4:13 PM, Paul Gilbert wrote:
Yes, but I don't think that's necessarily the right place for this. 
What we were going to do this summer was to make it easier to build 
foo-package.Rd files, without duplication of the information in the 
DESCRIPTION file.  I think that man page (or a man page linked from it) 
would be the right place for a detailed discussion like this.

This doesn't address the problem of someone who hasn't got the package 
installed yet, though perhaps CRAN could put a version of that man page 
(or all of them) online for browsing.  Unfortunately this hasn't 
happened yet, but maybe we'll get to it before 2.5.0.

Duncan Murdoch
#
[...]
The help pages are available on CRAN in PDF format, if there are strong
preferences to also get the HTML version online that should not be a major
problem.

Best,
Fritz
#
Sorry to join in late, I am at the Compstat conference and have limited
email access. What Seth describes in the above paragraph is exactly what I
had in mind when splitting the single Depends field we had into Depends
and Suggests: Depends are a necessity to run the package, Suggests is nice
to have but not necessary. If you know how to use a package you may the
decide not to install a package that is only suggested, but

  * may not be interested to execute the examples,
  * know that you never need the extra functionality
  * ...

so it should not be auto-installed unless you ask for it (the default
could also be the other way round, the point is that it should be possible
to have package foo but not the packages it only suggests). On CRAN we
check with all suggestions to test all bits and pieces, having an option
in R CMD check to test only with suggests may be nice, if there is use for
it.

Ad the wording in the manual: obviously that is not optimal (otherwise no
need for parts of this email thread), perhaps somebody else than the
original author (=me) could try to improve it for 2.4 after this
clarifications?  Otherwise I will give it a shot next week after I return
from Rome.

Best,
Fritz
#
PaulG> Martin Maechler wrote:
PaulG> I still like this idea.  I prefer 'canMakeUseOf' to 
PaulG> 'isHappilyCoworkingWith'  mainly because it seems less ambiguous.
An internal environment variable called

  _R_CHECK_FORCE_SUGGESTS_

which controls this has been in place for quite some time now.  One can
trivially add a Perl R CMD check configure variable for it.  I am a bit
hesitant to add a --force-suggests cola to R CMD check, as this
hardwires a legacy dependency model which may not be up to future needs.

As an aside, I have never understood whe developers have need for such
an option (as I would have assumed that they'd typically try to check
all of their code).

-k
#
>> Duncan Murdoch <murdoch at stats.uwo.ca> writes:
    >>> I think we need an option to R CMD check rather than a new field in the
    >>> DESCRIPTION.  Currently a package could be mentioned for any of these
    >>> reasons:
    >>> 
    >>> 1.  To make functions, examples or vignettes work
    >>> 2.  To allow optional functionality in functions, examples or vignettes.
    >>> 3.  Because it contains complementary functions.
    >>> 
    >>> I don't think we really need to worry about 3:  it should be contained
    >>> in 1 or 2, if reasonably complete examples are given.
    >>> 
    >>> Case 1 is handled by Depends.
    >> 
    >> I think there is an important distinction between a dependency needed
    >> for the package to function and a dependency needed to demonstrate
    >> said functionality via an example or vignette.  The former is what
    >> Depends is about, the latter is something else (Suggests).

    FrL> Sorry to join in late, I am at the Compstat conference and have limited
    FrL> email access. What Seth describes in the above paragraph is exactly what I
    FrL> had in mind when splitting the single Depends field we had into Depends
    FrL> and Suggests: Depends are a necessity to run the package, Suggests is nice
    FrL> to have but not necessary. If you know how to use a package you may the
    FrL> decide not to install a package that is only suggested, but

    FrL> * may not be interested to execute the examples,
    FrL> * know that you never need the extra functionality
    FrL> * ...

    FrL> so it should not be auto-installed unless you ask for
    FrL> it (the default could also be the other way round, the
    FrL> point is that it should be possible to have package foo
    FrL> but not the packages it only suggests). On CRAN we
    FrL> check with all suggestions to test all bits and pieces,
    FrL> having an option in R CMD check to test only with
    FrL> suggests may be nice, if there is use for it.

Yes.
However, I see two (related) problems with the current 'Suggests'
and that's why I opened this thread proposing to have a 
(what I now would want to simply call)  'canUse' :

1) For 'R CMD check' (and hence CRAN checking),
   Packages in 'Suggests' must be require()able, and
   hence all testing only happens *with* the suggested packages
   being there, and not without.

2) "Suggests"  suggests to the human reader of DESCRIPTION that
   the package authors suggest to also install the packages listed
   there.
   Now there are cases, I (as package author) want to show some
   stuff, or even provide compatibility functionality for some
   packages that are related to mine, but which I really do not ``suggest''
   to also be installed, e.g., because the other packages do
   similar stuff as mine, but I believe my package to be
   superior.  In such a case, I may, e.g., want to provide 
   functions for porting the other package classes to my package's.

Duncan Murdoch has proposed to take care of "1)" by
still only use 'Suggests' but adding another option to 'R CMD
check', let's say   --no-suggests  which would run all the
checks without having the suggested packages available  
--- something not quite easy to implement, BTW:
Imagine the typical windows users who (AFAICS) always only use
one library into which they install all packages.
How do you want the 
    if( require(<my_suggested_package>) ) {
       ...
    }
clause *not* to be triggered in such a case ?
I do agree quite a bit that such a '--no-suggests' option would
be very useful for 'R CMD check' -- in addition to my proposal.

Further, I think "2)" above is not taken care of anyway.
After all the interesting statements and alternative proposals,
I'm still proposing to introduce a  'canUse'  field for DESCRIPTION
which
  a) has a "human-readable intent" of being weaker than 'Suggests'
  b) will not require its packages to be available for R CMD check
  c) conveys extra information about the package's context, to humans, and
  d) will potentially be used in automated or semi-manual 
     ``R package database management''

Martin

    FrL> Ad the wording in the manual: obviously that is not
    FrL> optimal (otherwise no need for parts of this email
    FrL> thread), perhaps somebody else than the original author
    FrL> (=me) could try to improve it for 2.4 after this
    FrL> clarifications?  Otherwise I will give it a shot next
    FrL> week after I return from Rome.
#
FrL> Sorry to join in late, I am at the Compstat conference and have limited
FrL> email access. What Seth describes in the above paragraph is exactly what I
FrL> had in mind when splitting the single Depends field we had into Depends
FrL> and Suggests: Depends are a necessity to run the package, Suggests is nice
FrL> to have but not necessary. If you know how to use a package you may the
FrL> decide not to install a package that is only suggested, but

FrL> * may not be interested to execute the examples,
FrL> * know that you never need the extra functionality
FrL> * ...

FrL> so it should not be auto-installed unless you ask for
FrL> it (the default could also be the other way round, the
FrL> point is that it should be possible to have package foo
FrL> but not the packages it only suggests). On CRAN we
FrL> check with all suggestions to test all bits and pieces,
FrL> having an option in R CMD check to test only with
FrL> suggests may be nice, if there is use for it.
Martin,

I don't think such info should be human-readable.  It should be in a
standardized format so that we can have tools to compute on such
information.  E.g., a simple subject-predicate-object model as used in
the W3C's semantic web.

I am slightly nervous about moving in this direction, though, as I think
it implies that repository maintainers deploy processes which validate
the semantics of the package metadata.  But eventually we will have to
do this in any case.

-k
#
On 8/30/2006 3:21 AM, friedrich.leisch at stat.uni-muenchen.de wrote:
Just to clarify: "this hasn't happened yet" was meant to apply to the 
earlier part of my message, the changes necessary to make the package 
man page easier to maintain.

Duncan Murdoch
#
Sure, that is how I read it (sorry for not deleting your last sentence in
my reply). The question remains wether we should put HTML pages of all
package help pages on CRAN? Kurt builds them anyway when checking the
packages, so it is mostly a matter of copying them into the HTTP tree and
some linking.

Why we did not do it so far is that it really increases the size of
mirrors a lot, as those files would not be compressed (nd there are heaps
of them).

Best,
Fritz
#
Sorry, I did not want to give the impression of ignoring your proposal,
but wanted to clarify the ratio behid what we currently have first and
then ran out of time. I agree that a new field like you describe above can
be very usefull, the only thing I worry about is if it makes life really
easier or if it confuses users and developers even more.

Debian has Depends/Recommends/Suggests and after 10 years of using Debian
I would still have to got to the Debian guidelines to learn what the exact
difference between the latter two is. There certainly is a distinction,
and I knew it at some point in time, but when I read a package description
now I always condense it to needed/optional in my brain ... hence I went
for a two-layer model in R.

Fritz

PS: I would have immediate use for canUse, because flexclust "suggests"
cluster only because it has coercion methods for converting to flexclust
objects ... canUse certainly would describe better what is going on.