From mtmorgan at fhcrc.org  Wed Sep 10 20:49:31 2014
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Wed, 10 Sep 2014 11:49:31 -0700
Subject: [Rd] install.packages misleads about package availability?
Message-ID: <54109D3B.6080804@fhcrc.org>

In the context of installing a Bioconductor package using our biocLite() 
function, install.packages() warns

 > install.packages("RUVSeq", repos="http://bioconductor.org/packages/2.14/bioc")
Installing package into '/home/mtmorgan/R/x86_64-unknown-linux-gnu-library/3.1-2.14'
(as 'lib' is unspecified)
Warning message:
package 'RUVSeq' is not available (for R version 3.1.1 Patched)

but really the problem is that the package is not available at the specified 
repository (it is available, for the same version of R, in the Bioc devel 
repository http://bioconductor.org/packages/3.0/bioc).

I can see the value of identifying the R version, and see that mentioning 
something about 'specified repositories' would not necessarily be helpful. Also, 
since the message is translated and our user base is international, it is 
difficult to catch and process by the biocLite() script.

Is there a revised wording that could be employed to more accurately convey the 
reason for the failure, or is this an opportunity to use the condition system?

Index: src/library/utils/R/packages2.R
===================================================================
--- src/library/utils/R/packages2.R	(revision 66562)
+++ src/library/utils/R/packages2.R	(working copy)
@@ -46,12 +46,12 @@
      p0 <- unique(pkgs)
      miss <-  !p0 %in% row.names(available)
      if(sum(miss)) {
-	warning(sprintf(ngettext(sum(miss),
-				 "package %s is not available (for %s)",
-				 "packages %s are not available (for %s)"),
-			paste(sQuote(p0[miss]), collapse=", "),
-			sub(" *\\(.*","", R.version.string)),
-                domain = NA, call. = FALSE)
+        txt <- ngettext(sum(miss), "package %s is not available (for %s)",
+                        "packages %s are not available (for %s)")
+        msg <- simpleWarning(sprintf(txt, paste(sQuote(p0[miss]), collapse=", "),
+                                     sub(" *\\(.*","", R.version.string)))
+        class(msg) <- c("packageNotAvailable", class(msg))
+	 warning(msg)
          if (sum(miss) == 1L &&
              !is.na(w <- match(tolower(p0[miss]),
                                tolower(row.names(available))))) {

-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



[Rd] install.packages misleads about package availability?
Martin Morgan