# Re: [R] Using expression in Hmisc Key()

From: Michael Kubovy <kubovy_at_virginia.edu>
Date: Thu, 6 Dec 2007 04:12:27 -0500

Hi Dieter,

I actually solved *my* problem:

Key(x = 0.667, y = 0.833, lev = c(expression(italic(b)), expression(italic(c)), expression(italic(d))),

other = list(title = expression(italic(v)), cex.title = 1))

I was able to figure this out only by looking at the code for Key(), because I hadn't come across the 'lev' argument in the documentation (in fact Key does not appear in the list of functions of Hmisc; I discovered its usefulness by consulting the examples for xYplot()). I would have expected this argument to be called 'labels' (see help(labels)), (or at least 'levels'):

function (x = NULL, y = NULL, lev = c("b", "c", "d"), cex = c(0.7, 0.7, 0.7), col = c(2, 4, 9), font = c(1, 1, 1), pch = c(1, 2, 16), other = NULL)
{

}

Note that the NULL setting of the parameter may be useful for programming, but it is not useful to anyone reading the code. How is one to proceed after having read help(NULL)?

At the same time, I have no grounds for complaining about the documentation for Key(): Frank Harrell is giving away his work. His examples are extensive, and his functions always work as advertised. Sometimes they also work as not advertised.

On Dec 6, 2007, at 2:17 AM, Dieter Menne wrote:

> Michael Kubovy <kubovy <at> virginia.edu> writes:
>
>>
>> Dear r-helpers,
>>
>> How do I tell xYplot() and Key() that I want the labels in italic?
>>
> ....
>> Key(x = 0.667, y = 0.833, other = list(title = expression(italic(v)),
>> cex.title = 1,
>> labels = c(expression(italic(b)), expression(italic(c)),
>> expression(italic(d)))))
>> dev.off()
>
> Michael,
>
> I have submit a similar case last week to the Bug tracker. Maybe you
> can raise
> that "enhancement request" to "defect"
>
> http://biostat.mc.vanderbilt.edu/trac/Hmisc/ticket/21
>
> Dieter
>
> -----------
> The Key function generated by some plot commands should have a ...
> parameter.
> Otherwise, the ... in rlegend is useless, and it would be nice to be
> able to
> suppress the box, for example.
>
> Key = function (x = NULL, y = NULL, lev = c("No Fail", "Fail"), pch
> = c(16, 1))
> { .. part omitted
>
> rlegend(x, y, legend = lev, pch = pch, ...) invisible()
>
> }

Professor Michael Kubovy
University of Virginia
Department of Psychology
```USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
```

WWW: http://www.people.virginia.edu/~mk9y/

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 06 Dec 2007 - 09:14:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Dec 2007 - 20:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.