From hb at stat.berkeley.edu  Tue Oct 27 05:05:05 2009
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Mon, 26 Oct 2009 21:05:05 -0700
Subject: [Rd] help.start() only recognizes forward slashes in R_LIBS_USER
	which is not the default case
Message-ID: <59d7961d0910262105h6a6cca00gccf4f2f2b6093a5d@mail.gmail.com>

I've found that the HTML help system started via help.start() requires
all forward slashes in R_LIBS_USER otherwise the Packages page is
corrupt/non-working.  Note that by default R_LIBS_USER is set by R on
startup.

Example 1:
With R_LIBS_USER=C:/Users/JohnDoe/R/win-library/2.10
> help.start() [and go to "Packages"]
If nothing happens, you should open
'http://127.0.0.1:6850/doc/html/index.html' yourself
This works!

Example 2:
With: R_LIBS_USER=C:\\Users\\JohnDoe\\R\\win-library\\2.10
> help.start() [and go to "Packages"]
If nothing happens, you should open
'http://127.0.0.1:6850/doc/html/index.html' yourself
Warning message:
In sub(paste(lib, "([^/]*)", "DESCRIPTION$", sep = "/"), "\\1",  :
  regcomp error:  'Invalid back reference'
> Making packages.html ...

with http://127.0.0.1:6850/doc/html/packages.html displaying:

Error in sub(paste(lib, "([^/]*)", "DESCRIPTION$", sep = "/"), "\\1",  :
  invalid regular expression
'C:\Users\JohnDoe\R\win-library\2.10/([^/]*)/DESCRIPTION$'

Example 3:
With R_LIBS_USER=C:\\Users\\JohnDoe/R/win-library/2.10
> help.start() [and go to "Packages"]
If nothing happens, you should open
'http://127.0.0.1:6850/doc/html/index.html' yourself

with http://127.0.0.1:6850/doc/html/packages.html displaying:

Packages in C:\Users\JohnDoe\R\win-library\2.10

C:\Users\JohnDoe/R/win-library/2.10/abind/DESCRIPTION	-- Title is missing --
C:\Users\JohnDoe/R/win-library/2.10/affxparser/DESCRIPTION	-- Title is
missing --
C:\Users\JohnDoe/R/win-library/2.10/affy/DESCRIPTION	-- Title is missing --

where the abind link is
http://127.0.0.1:6850/library/C:%5CUsers%JohnDoe/R/win-library/2.10/abind/DESCRIPTION/html/00Index.html
and similarly for affxparser and so on.

This third case may(?)/is(?) set by R on startup if R_LIBS_USER is not
set, cf. help(.libPaths):

     By default 'R_LIBS' is unset, and 'R_LIBS_USER' is set to
     subdirectory 'R/win-library/x.y' of the home directory, for R
     x.y.z.

because HOME=C:\Users\JohnDoe is set by Windows.

It seems like the HTML help server only recognizes forward slashes in
R_LIBS_USER.

The following patch solves the problem (can be added to ~/.Rprofile):

.libPaths(gsub("\\", "/", .libPaths(), fixed=TRUE));


/Henrik

> sessionInfo()
R version 2.10.0 Patched (2009-10-26 r50212)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_2.10.0



[Rd] help.start() only recognizes forward slashes in R_LIBS_USER which is not the default case
Henrik Bengtsson