[R] expressions and paste
Emily Baldock
emily.baldock at ctsu.ox.ac.uk
Fri Nov 12 12:26:19 CET 2004
I am trying to get a subscript into the title.
My expression is quote(bold(apoA[bold("1")]))
I have managed to get something near to what I want with
sd2 <-1.882
measure <- "g/L"
direction <- "increase"
chem <- quote(bold(apoA[bold("1")]))
plot(0,0)
titletxt <- substitute(paste("per ", sd2, " ",measure," ", direction, "\n in usual ",chem),
list(chem = chem,sd2=sd2,measure=measure,direction=direction))
title(main=titletxt,cex.main=1.4,font.main=2)
However, I can't get bold text this way.
Emily.
On 11 Nov 2004 at 12:58, Roger D. Peng wrote:
> Can you be a bit more specific? Exactly what kind of symbol are you
> trying to put in the title?
>
> -roger
>
> Emily Baldock wrote:
> > I have written a function to plot data which will be used for various different chemistries.
> > A simplified version is:
> > plot_data <- function(risk,levels,chem,sd2,measure){
> > plot(risk, levels,main=paste ("per", sd2, measure, "\n in usual", chem))
> > }
> > The problem is with the title.
> > This works fine if the variable "chem" is just text, but if it is an expression then obviously it won't work.
> > I have experimented with various things and I am at a complete loss for how to insert an expression into the middle of
> > a title. If the expression was going in directly I would use main=expression(paste("text ", expression, " text")) but
> > again this doesn't work. Can anyone help? thanks Emily.
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
>
> --
> Roger D. Peng
> http://www.biostat.jhsph.edu/~rpeng/
>
More information about the R-help
mailing list