Corey Corey - 1 year ago 107
R Question

Starting axis label with subscript

I am trying to add specific labels to my axes in R. I have read numerous posts indicating to use the

function and brackets to do this. The label I want to add to my axis starts and ends with a subscript.

plot(1:10, xlab=expression([10]'x'[5])

Starting the label with a subscript results in an error:

Error: unexpected '[' in "plot(1:10, xlab=expression(["

I have attempted to add in empty quotation marks as a form of placeholder, but it doesn't seem to work.

Any help would be appreciated.

Answer Source

You need to separate multiple subscripts with an asterisk (*), and start the expression with an empty string

plot(1:10, xlab=expression(''[10]*'x'[5])) 

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download