I am trying to add specific labels to my axes in R. I have read numerous posts indicating to use the expression
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.
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]))