[R] Puzzled at a trivial function using Hmisc::setps

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Oct 23 09:17:05 CEST 2004


Most of us have no idea what this does.  Please ask questions about Hmisc 
of its author (Frank Harrell), or write them in a way accessible to people 
not familiar in detail with the package.

The posting guide asks you to read the help page, and the answer is on 
that help page, although in a less-than-obvious way.  Since the problem is 
with the Hmisc documentation, this really does need to be addressed to the 
author.

Reading the source shows you need setps(filename=f, w=4.5, type="char"),
but the help says

filename: character string specifying file prefix.  For 'setps' or
          'setpdf' omit surrounding quotes unless 'type="char"'.

    type: set 'type=1' to use black on white background, smaller
          pointsize, and other settings that are good for making
          overhead transparencies and graphs to include in reports.
          Set 'type=3' for 5" x 7" landscape plots, and 'time=4' for
          overheads. For 'setps' and 'setpdf', specifies whether
          'filename' is quoted or not.

without telling you what values are accepted or what they do (and indeed
without accurately describing the effect, which is

    filebase <- if (type == "char")
        filename
    else as.character(substitute(filename))

.)


On Sat, 23 Oct 2004, Ajay Shah wrote:

> I have done:
> 
>   library(Hmisc)
>   mysetps <- function(f) {setps(filename=f, w=4.5)}
> 
> Now when I set about doing
> 
>   mysetps("a")
>   blah
>   mysetps("b")
>   blah
> 
> etc.
> 
> Problem: I find that only one file "f.ps" gets created.
> 
> My intent had been to create "a.ps", "b.ps", etc., all using the
> argument w=4.5 with the setps() function of Hmisc::setps.
> 
> Just in case it was R being unhappy with one-letter variable names, as
> sometimes happens, I also replaced "f" with "file" and that didn't help.

*R* has no idea how many letters a variable name has, but you are using 
Hmisc here.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list