skimr:如何删除直方图?(skimr: how to remove histogram?)

2019-09-29 00:18发布

我想使用的功能skim来自R包skimr在Windows上。 不幸的是,在许多情况下列, hist被不正确地打印(与许多<U+2587>样的符号),如在下面的例子。

问:有没有一种简单的方法或者禁用列“历史”,并防止它被打印或防止它在所有被计算出来的? 有没有像一个选项hist = FALSE

capture.output(skimr::skim(iris))
#>  [1] "Skim summary statistics"                                                                         
#>  [2] " n obs: 150 "                                                                                    
#>  [3] " n variables: 5 "                                                                                
#>  [4] ""                                                                                                
#>  [5] "-- Variable type:factor ------------------------------------------------------------------------"
#>  [6] " variable missing complete   n n_unique                       top_counts"                        
#>  [7] "  Species       0      150 150        3 set: 50, ver: 50, vir: 50, NA: 0"                        
#>  [8] " ordered"                                                                                        
#>  [9] "   FALSE"                                                                                        
#> [10] ""                                                                                                
#> [11] "-- Variable type:numeric -----------------------------------------------------------------------"
#> [12] "     variable missing complete   n mean   sd  p0 p25  p50 p75 p100"                              
#> [13] " Petal.Length       0      150 150 3.76 1.77 1   1.6 4.35 5.1  6.9"                              
#> [14] "  Petal.Width       0      150 150 1.2  0.76 0.1 0.3 1.3  1.8  2.5"                              
#> [15] " Sepal.Length       0      150 150 5.84 0.83 4.3 5.1 5.8  6.4  7.9"                              
#> [16] "  Sepal.Width       0      150 150 3.06 0.44 2   2.8 3    3.3  4.4"                              
#> [17] "     hist"                                                                                       
#> [18] " <U+2587><U+2581><U+2581><U+2582><U+2585><U+2585><U+2583><U+2581>"                               
#> [19] " <U+2587><U+2581><U+2581><U+2585><U+2583><U+2583><U+2582><U+2582>"                               
#> [20] " <U+2582><U+2587><U+2585><U+2587><U+2586><U+2585><U+2582><U+2582>"                               
#> [21] " <U+2581><U+2582><U+2585><U+2587><U+2583><U+2582><U+2581><U+2581>"

更改区域设置为中国(在这个答案 ),不解决这个问题,但使情况变得更糟:

Sys.setlocale(locale = "Lithuanian")
df <- data.frame(x = 1:5, y = c("Ą", "Č", "Ę", "ū", "ž"))

Sys.setlocale(locale = "Chinese")
capture.output(skimr::skim(df))

#> Error in substr(names(x), 1, options$formats$.levels$max_char) : invalid multibyte string at '<c0>'

Answer 1:

skim_with(numeric = list(hist = NULL))这是在“使用Skimr”晕影。



文章来源: skimr: how to remove histogram?
标签: r skimr