[R] Using unicode characters with paste or sprintf
Mike Toews
mwtoews at sfu.ca
Fri May 23 01:58:50 CEST 2008
Hi,
I'm having difficulties with Unicode characters with R 2.7.0 on Windows
XP SP2. I'd like to use a delta character, which I'd also like to mix
with other formatted output using paste() or sprintf(). On my system, I
can successfully do this with a static string:
print("\u0394Q = 2.2 L/s")
[1] "ΔQ = 2.2 L/s"
However, when I use paste() or sprintf(), the Unicodeness is lost:
paste("\u0394Q =",round(1.2345,3),"L/s")
[1] "<U+0394>Q = 1.234 L/s"
sprintf("\u0394Q = %.3f L/s",1.2345)
[1] "<U+0394>Q = 1.234 L/s"
Any incite why this happens? Also are there any suggestions or
workarounds that I can use to produce a formatted string rather than a
static string?
Thanks in advance.
+mt
More information about the R-help
mailing list