[Rd] html help fails for named vector objects (PR#9927)

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Sep 23 10:29:44 CEST 2007


John.Maindonald at anu.edu.au wrote:
>    help(letters, htmlhelp=TRUE) fails.
>
> Under the Mac OSX gui, the message is 'Help for the topic "a" was not  
> found.' Under the version documented below, and under Windows, the  
> message is
>
>    "No documentation for 'a' in specified packages and libraries:"
> repeated for all the elements of letters, then followed by
>    "you could try 'help.search("a")'",
> again repeated for all elements of letters.
>
> The outcome seems similar for any character vector (including matrix)  
> object, e.g. the matrix 'primateDNA' in the DAAGbio package.
>
> The following have the expected result
>    help("letters", htmlhelp=TRUE)
>    help(letters, htmlhelp=FALSE)
>
>   
Not for me. I get the same thing with or without htmlhelp. (That IS what 
I expected, though....)

The logic in help is

    ischar <- try(is.character(topic), silent = TRUE)
    if (inherits(ischar, "try-error"))
        ischar <- FALSE
    if (!ischar)
        topic <- deparse(substitute(topic))

So a character argument implies that it contains the names of help 
topics. That isn't quite what the documentation says, though:

   topic: usually, the name on which documentation is sought. The name
          may be quoted or unquoted (but note that if 'topic' is the
          name of a variable containing a character string
          documentation is provided for the name, not for the character
          string).

It is the documentation that is wrong. We could implement what it says, 
but then it would be a require considerable contortions to get help on a 
topic stored in a variable (e.g., coming from a help field in a GUI).

It isn't clear to me that  it should try all elements of a character 
vector of length > 1. That looks like a bit of a booby trap to me -- 
what if it accidentally caught a variable with a few million elements? A 
length check should be rather easy.


> The same result is obtained with R-2.5.1.
>
>
> --please do not edit the information below--
>
> Version:
> platform = i386-apple-darwin8.10.1
> arch = i386
> os = darwin8.10.1
> system = i386, darwin8.10.1
> status = beta
> major = 2
> minor = 6.0
> year = 2007
> month = 09
> day = 22
> svn rev = 42941
> language = R
> version.string = R version 2.6.0 beta (2007-09-22 r42941)
>
> Locale:
> C
>
> Search Path:
> .GlobalEnv, package:testpkg, package:stats, package:graphics,  
> package:grDevices, package:utils, package:datasets, package:methods,  
> Autoloads, package:base
>
> John Maindonald             email: john.maindonald at anu.edu.au
> phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
> Centre for Mathematics & Its Applications, Room 1194,
> John Dedman Mathematical Sciences Building (Building 27)
> Australian National University, Canberra ACT 0200.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list