2

In R for Windows I can assign a unicode character as follows:

(u <- "\U0444")
# [1] "ф"

However, assigning the string to a data frame gives an unreadable output:

x <- data.frame(1)
setNames(x,u)
#   <U+0444>
# 1        1

Session Info

R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    
antonio
  • 10,629
  • 13
  • 68
  • 136
  • Looks like it's just the way R prints the `data.frame`. If you try `colnames(x) = u;colnames(x)` you should see the correct symbol. – Mike H. May 17 '17 at 12:42
  • @MikeH.: well, even if it were so, it would not be the _proper way to print._ However, it works on Ubuntu and on Windows too if you switch to the similar `\U0424`. Beside `colanames(x)`, `names(x)` prints properly too, but this question is about printing a whole data frame. – antonio May 17 '17 at 13:46
  • Interestingly, if it's a matrix it works: `as.matrix(x)`. See this question: http://stackoverflow.com/questions/17715956/why-do-some-unicode-characters-display-in-matrices-but-not-data-frames-in-r – Mike H. May 17 '17 at 13:57

0 Answers0