I can't seem to display greek letters in r. I'm working with RStudio, and I can't seem to display greek characters no matter what I try. Initially I tried to display greek letters inside bquote
, using syntax from a class I took, which the prof. published and demonstrated it worked in class. When all it showed was squares**, I tried more basic ways of displaying greek letters. I tried to use expression
and than I tried to find the simplest way and ran this syntax which I found online:
mycoef <- rnorm (1000)
hist(mycoef, main = expression(beta))
In all cases it either display a square (like an unrecognized symbol), or just the word (beta, chi, etc.,). This syntax also displayed a square using R instead of RStudio.
I tried to change a bit the encoding of the file (ASCII/UTF-8), but this didn't change anything. I am working on a mac (macOS Sierra 10.12.4) if that changes anything.
**when using the bquote
syntax, greek letters were not the only characters it changed to squares. Also == and ~~ without quotes were displayed as squares.
This is my sessionInfo()
-
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4
Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale: [1] pt_PT.ISO8859-1/pt_PT.ISO8859-1/pt_PT.ISO8859-1/C/pt_PT.ISO8859-1/C
attached base packages: [1] grid stats graphics grDevices utils datasets methods base
other attached packages: [1] plyr_1.8.4 meta_4.8-4 openxlsx_4.0.17
loaded via a namespace (and not attached): [1] compiler_3.4.2 tools_3.4.2 Rcpp_0.12.13
=====
Note that as a try to fix this problem I ran this syntax that is displayed in the sessionInfo - Sys.setlocale("LC_ALL", "pt_PT.ISO8859-1")
, which didn't help.
Thanks!