How would you add a subscript to one particular word of a title in R? For example, suppose the title is "A_2 and B_2."
How would you add these two subscripts? I know that expression("A"[2])
and expression("B"[2])
individually add subscripts to these letters.
You do not need paste
(or quotes for that matter) at all:
expression( A[2]~and~B[2] )
Test:
plot(1,1, main=expression( A[2]~and~B[2] ) )
The syntactic principle is that tildes (which creates a space) and asterisks (non-space plotmath separator) are used to separate items and that no quotes are needed unless you are using a plotmath function name .... such as wanting the word "paste" or "sqrt" to appear in the displayed version of the expression.