[R] UTF-8 to the console

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Thu Jun 23 12:47:46 CEST 2022


Wikipedia indicates that there are multiple flavors of UTF-8, but here is one solution.
Wikipedia lists Unicode characters: https://en.wikipedia.org/wiki/List_of_Unicode_characters Way towards the bottom of the article is a table of math symbols.
print("x\u2265y")
print("a\u223cy")


Tim

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Helmut Schütz
Sent: Thursday, June 23, 2022 6:26 AM
To: r-help using r-project.org
Subject: [R] UTF-8 to the console

[External Email]

Dear all,

I want to send UTF-8 characters to the console. Font in the GUI-Preference 'Lucida Console', supporting the desired symbols:
greater than or equal: UTF-8 2265, HTML-entity ≥ HTML-Unicode ≥ TeX \ge approximately equal: UTF-8 2248, HTML-entity ≈ HTML-Unicode ≈ TeX \approx

txt <- "x ≥ y, x \u2265 y; a ≈ b, a \u2248 b"
Encoding(txt) <- "UTF-8"
print(txt)
[1] "x = y, x = y; a \230 b, a \230 b"
cat(txt, "\n")
x = y, x = y; a ˜ b, a ˜ b

Desired "x ≥ y, x ≥ y; a ≈ b, a ≈ b"

I'm sending the email in UTF-8. Don’t know how @r-project.org is configured (ASCII?) If you see garbage, I'm sorry but you should get the idea.

R 4.2.0 on Windows 7 (UCRT10.0.10240.16390) and Windows 11.

Helmut
--
Ing. Helmut Schütz
BEBAC – Consultancy Services for
Bioequivalence and Bioavailability Studies Neubaugasse 36/11
1070 Vienna, Austria
E helmut.schuetz using bebac.at <mailto:helmut.schuetz using bebac.at>

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=8xremj7fegxhsnLOZ-LH70y0JDttRWSw_iNumafCnpOKJtvwv9LZG42rTfrJSPJ4&s=WYrKq8LmaHVI5aCB3Je6H3CuNkvPGP4cRbbxmRTr6I0&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwIFaQ&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=8xremj7fegxhsnLOZ-LH70y0JDttRWSw_iNumafCnpOKJtvwv9LZG42rTfrJSPJ4&s=5KDJgrBy7d0uYnfEWGMwwZX-jomihY43Kb9slt_Yhxg&e=
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list