Dear R-Users,

I think I have encountered a potential bug (or at least unwanted behavior),
but I'm not sure so I wanted to post here first.  Lately I've been
encountering an error when running a package I put together.  I have my
package set up to check for updates when it loads but this error occurs and
stops the package from loading:

Error : .onLoad failed in loadNamespace() for 'rNMR', details:
  call: read.dcf(file = tmpf)
  error: Line starting '<SCRIPT language=Jav ...' is malformed!
Error: package/namespace load failed for 'rNMR'


I tracked to the following line of code from my package:

available.packages(contrib.url(repos = "http://rnmr.nmrfam.wisc.edu/R/",
type = "win.binary"))


I dug a little deeper and found the following line of code from
available.packages() to be causing the problem:

z <- tryCatch(download.file(url = paste(repos, "PACKAGES.gz", sep = "/"),
destfile = tmpf, method = method, cacheOK = FALSE, quiet = TRUE, mode =
"wb"), error = identity)


The problem occurs because "PACKAGES.gz" does not exist in the repository,
so my router redirects the invalid URL to a search page and some JavaScript
is downloaded instead.  The error is generated when R tries to read the
downloaded file:

res0 <- read.dcf(file = tmpf)
Error in read.dcf(file = tmpf) :
  Line starting '<SCRIPT language=Jav ...' is malformed!


The repository does have a "PACKAGES" file, but it never gets read because
download.file() does not generate an error.  I've fixed the issue by
uploading a "PACKAGES.gz" file to the repository, but I wanted to point out
the issue in case anybody else has encountered this problem.  This problem
may be unique to my particular system configuration, in which case a fix may
not be justified.  Otherwise, it may be a good idea to check for
a "PACKAGES" file in the repository if an error is encountered when trying
to read the downloaded "PACKAGES.gz" file.

Thanks,
Seth

R Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = Patched
 major = 2
 minor = 13.1
 year = 2011
 month = 08
 day = 19
 svn rev = 56771
 language = R
 version.string = R version 2.13.1 Patched (2011-08-19 r56771)

Windows 7 (build 7601) Service Pack 1

Locale:
 LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Search Path:
 .GlobalEnv, package:tcltk, package:stats, package:graphics,
package:grDevices, package:utils,
 package:datasets, package:methods, Autoloads, package:base

	[[alternative HTML version deleted]]

