[R] gathering denominator under frac

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri Feb 2 12:05:47 CET 2024

Às 10:01 de 02/02/2024, Troels Ring escreveu:
> Hi friends - I'm plotting a ratio of bicarbonates i ggplot2 and
> ylab(expression(paste(frac("additive BIC","true BIC")))) worked OK - but 
> now I have been asked to put the chemistry instead - so I wrote
>   ylab(expression(paste(frac("additive",HCO[3]^"-","true",HCO[3]^"-")))) 
> - and frac saw that as additive = numerator and HCO3- = denominator and 
> the rest was ignored-
> So how do I make frac ignore the first ","  and print the fraction as I 
> want?
> All best wishes
> Troels
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

This seems to work. Instead of separating the two numerator strings with 
a comma, separate them with a tilde. The same goes for the denominator.
And there is no need for double quotes around "additive" and "true".


g <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +

g + ylab(expression(paste(frac(

Hope this helps,

Rui Barradas

Este e-mail foi analisado pelo software antivírus AVG para verificar a presença de vírus.

More information about the R-help mailing list