r - strwidth: How to get the correct width for umlauts and other accented/special characters? -
consider following example:
txt <- c("abc", "äéß") nchar(txt) # [1] 3 3 strwidth(txt, units = "inches", family = "mono") # [1] 0.4166667 0.8333333 plot(0, type = "n"); text(1, c(0, .3), txt, family = "mono", cex = 5)
i'd have expected strwidth
return [1] 0.4166667 0.4166667
when using nonproportional font. can expected output without replacing non-ascii characters? help.
session info: r version 3.1.3 (2015-03-09), platform: x86_64-w64-mingw32/x64 (64-bit), running under: windows 7 x64 (build 7601) service pack 1, locale: lc_collate=german_germany.1252, lc_ctype=german_germany.1252, lc_monetary=german_germany.1252, lc_numeric=c, lc_time=german_germany.1252
edit:
as noted in comments, strwidth
problem seems known rstudio issue.
Comments
Post a Comment