Chart subscribers in R

I cannot find a way to write indexes in the header or subheading in R. How can I write v 1,2 with 1,2 as indices?

Thanks for your help!

+82
r plot subscript
Apr 14 '12 at 18:59
source share
5 answers

expression is your friend:

 plot(1,1, main=expression('title'^2)) #superscript plot(1,1, main=expression('title'[2])) #subscript 
+115
Apr 14 '12 at 19:05
source share

If you want to have multiple indexes in the same text, use an asterisk (*) to separate the sections:

 plot(1:10, xlab=expression('hi'[5]*'there'[6]^8*'you'[2])) 
+102
May 21 '14 at 9:15
source share

See expression

 plot(1:10,main=expression("This is a subscript "[2])) 

enter image description here

+24
Apr 14 2018-12-12T00:
source share

Subscript and referencing stored value ...

 a <- 10 plot(c(0,1), c(0,1), type = 'n', ann = FALSE, xaxt = 'n', yaxt = 'n') text(0.2, 0.6, cex = 1.5, bquote(paste('S'['f']*' = ', .(a)))) 

enter image description here

+8
Apr 12 '16 at 9:12
source share

In another example, the expression works for negative superscripts without the need for quotation marks around a negative number:

 title(xlab=expression("Nitrate Loading in kg ha"^-1*"yr"^-1)) 

and you only need to * separate the sections as described above (when you write a superscript or index and you need to add more text to the expression after).

+2
Sep 21 '16 at 18:32
source share



All Articles