Skimr - cant seem to produce the histograms

佐手、 提交于 2019-12-30 10:14:08

问题


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 .


回答1:


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))

View(a)

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)

Hope this can help you.



来源:https://stackoverflow.com/questions/44253848/skimr-cant-seem-to-produce-the-histograms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!