7

came across this seemingly new package - skimr, which looks pretty nifty, and was trying it out and looks like I'm missing some package installation. Skim works fine except that it doesn't print the histogram, it is supposed to print for numeric variables. I am merely trying the examples given in the documentation.

Link to skimr documentation here - https://github.com/ropenscilabs/skimr#skimr

this is the code I'm using

    devtools::install_github("hadley/colformat")
    devtools::install_github("ropenscilabs/skimr")
    library(skimr)
    a<-skim(mtcars)
    dim(a)
    View(a)

instead of histograms being printed, I see some ASCII/unicode characters enter image description here.

Elin
  • 6,507
  • 3
  • 25
  • 47
ashleych
  • 1,042
  • 8
  • 25
  • 4
    Looks like a bug in the package where it doesn't work well on Windows: https://github.com/ropenscilabs/skimr/issues/54 – Marius May 30 '17 at 05:25

1 Answers1

7

A solution that can be used to workaround the above problem is to set the locale of the R system to Chinese and to set the font of the R console to NSimSun.

temp <- tempfile()
cat("font = NSimSun\n", file = temp, append = TRUE)
loadRconsole(file = temp)
Sys.setlocale( locale='Chinese' )

library(skimr)
(a <- skim(mtcars))

enter image description here

View(a)

enter image description here

In RStudio this solution works only partially. Histograms generated by skim can be visualized only using View after setting the locale of R to Chinese

Sys.setlocale( locale='Chinese' )
library(skimr)
a <- skim(mtcars)
View(a)

enter image description here

Hope this can help you.

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
  • 1
    Can you give a hint on the potential side effects of changing the language? – der_grund Jan 18 '18 at 07:22
  • Please, find the last chunk of code in [this question](https://stackoverflow.com/q/51340323/4783029). In that case, changing the locale resulted in an error. – GegznaV Jul 14 '18 at 14:18