Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skimr - cant seem to produce the histograms

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.

like image 296
ashleych Avatar asked May 30 '17 05:05

ashleych


People also ask

What is Skimr package in R?

skimr is designed to provide summary statistics about variables in data frames, tibbles, data tables and vectors. It is opinionated in its defaults, but easy to modify. In base R, the most similar functions are summary() for vectors and data frames and fivenum() for numeric vectors: summary(iris)

How do you hide a histogram in R?

Basically, you just need to add border=F to the hist function to remove the border of histogram bars.


1 Answers

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.

like image 108
Marco Sandri Avatar answered Sep 23 '22 15:09

Marco Sandri