[ESS] Print spark histograms from skimr package in Emacs ESS on Windows

Richard M. Heiberger rmh @end|ng |rom temp|e@edu
Wed Jan 24 21:04:56 CET 2018


This looks like an example of UTF-8 not working on Windows.

Windows in Emacs ESS
> UTF8.beta <- "\u03b2"
> UTF8.beta
[1] "ß"    ## wrong character
> UTF8.sharps <- "\u00DF"
> UTF8.sharps
[1] "ß"


Macintosh
> UTF8.beta <- "\u03b2"
> UTF8.beta
[1] "β"
> UTF8.sharps <- "\u00DF"
> UTF8.sharps
[1] "ß"
>

On Wed, Jan 24, 2018 at 10:52 AM, Vinh Nguyen <vinhdizzo using gmail.com> wrote:
> On Wed, Jan 24, 2018 at 7:17 AM, Vitalie Spinu <spinuvit using gmail.com> wrote:
>>
>>
>>  (set-buffer-process-coding-system 'windows-1252 'windows-1252)
>>
>> Try 'utf-8 or variants displayed by M-x list-coding-systems. If this works, you
>> can either set in ess-R-post-run-hook or in process-coding-system-alist.
>>
>
> Hmm, I evaluated in the ESS R buffer
>  (set-buffer-process-coding-system 'utf-8 'utf-8)
>
> which returned t, but I still get: the following output:
>
>> library(skimr); skim(cars)
> Skim summary statistics
>  n obs: 50
>  n variables: 2
>
> Variable type: numeric
>   variable missing complete  n  mean    sd min p25 median p75 max
> 1     dist       0       50 50 42.98 25.77   2  26     36  56 120
> 2    speed       0       50 50 15.4   5.29   4  12     15  19  25
>                                                               hist
> 1 <U+2583><U+2587><U+2587><U+2585><U+2582><U+2582><U+2581><U+2581>
> 2 <U+2581><U+2582><U+2583><U+2587><U+2585><U+2585><U+2583><U+2583>
>
>
> If I set to Chinese locale, I get:
>> Sys.setlocale("LC_CTYPE", "Chinese") # properly print skim on Windows
> [1] "Chinese (Simplified)_People's Republic of China.936"
>> library(skimr); skim(cars)
> Skim summary statistics
>  n obs: 50
>  n variables: 2
>
> Variable type: numeric
>   variable missing complete  n  mean    sd min p25 median p75 max     hist
> 1     dist       0       50 50 42.98 25.77   2  26     36  56 120  z ~
> ~ | y y x x
> 2    speed       0       50 50 15.4   5.29   4  12     15  19  25  x y
> z ~ | | z z
>
> (emacs displays \250 instead of a space under that "hist" column).
>
> Note that I also have LC_CTYPE=en_US.utf-8 in my environment, which
> gives the following warning in R (both in Emacs ESS and in regular R
> GUI console):
>
> Using the Intel MKL for parallel mathematical computing (using 4 cores).
> Default CRAN mirror snapshot taken on 2017-10-15.
> See: https://mran.microsoft.com/.
> During startup - Warning message:
> Setting LC_CTYPE=en_US.utf-8 failed
>
> Happy to test further if anyone
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list