[Rd] apropos() with partial name (PR#2461)

u9801539@leonard.anu.edu.au u9801539@leonard.anu.edu.au
Thu Jan 16 10:24:05 2003


> apropos(sort)
[1] "is.unsorted" "sort"        "sort.list"  
> apropos(sor)
Error in apropos(sor) : Object "sor" not found
> sor <- 0
> apropos(sor)
[1] "sor"         "is.unsorted" "sort"        "sort.list"  

Thus the behaviour of apropos() can depend on what objects
are in the workspace, which is surely not intended!

There are some weird consequences:
apropos(b) generates an error, while apropos(c) finds a
huge number of partial matches.

The problem is with the first line of the function, i.e.,
    if (!is.character(what)) 
        what <- as.character(substitute(what))

I suggest replacing this with:
    if (!is.character(substitute(what))) 
        what <- as.character(substitute(what))

apropos("sor") works fine.

I have checked this also on Darwin/X11, version 1.6.1

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 6.2
 year = 2003
 month = 01
 day = 10
 language = R

Windows XP Home Edition (build 2600) Service Pack 1.0

Search Path:
 .GlobalEnv, package:DAAG, package:ctest, Autoloads, package:base
John Maindonald                     email : john.maindonald@anu.edu.au
Centre for Bioinformation Science,  phone : (6125)3473        
c/o MSI,                            fax   : (6125)5549 
John Dedman Mathematical Sciences Building (Building 27)
Australian National University
Canberra ACT 0200
Australia