How can I put the + character in R
1 answer
I am assuming that you are going to put them in the plot. In this case, be sure to check out the help page ?plotmath
. In your example, you can use
plot(1,1,main=expression(paste("Mean", phantom(.)%+-%phantom(.), "SD or N (%)")))
If you are just using plain text output, it depends on the encoding you configured in your GUI. And how you enter this will depend on your operating system. You can enable the unicode escape code in the string
x<-"Mean \u00b1 SD or N (%)"
Encoding(x)<-"UTF-8"
x
#[1] "Mean ± SD or N (%)"
+6
source to share