| 1 |
#' Fix unicode histograms on Windows |
| 2 |
#' |
| 3 |
#' This functions changes your session's locale to address issues with printing |
| 4 |
#' histograms on Windows on versions of R below 4.2.1. |
| 5 |
#' |
| 6 |
#' There are known issues with printing the spark-histogram characters when |
| 7 |
#' printing a data frame, appearing like this: "<U+2582><U+2585><U+2587>". |
| 8 |
#' This longstanding problem originates in the low-level code for printing |
| 9 |
#' dataframes. This was addressed in R version 4.2.1. |
| 10 |
#' |
| 11 |
#' @seealso [skim_without_charts()] |
| 12 |
#' @export |
| 13 |
fix_windows_histograms <- function() { |
| 14 |
message( |
| 15 |
"This function will change your system locale. It may have other ", |
| 16 |
"unintended effects." |
| 17 |
) |
| 18 |
response <- readline("Continue? (Y/n)") |
| 19 |
if (tolower(response) != "n") { |
| 20 |
Sys.setlocale("LC_CTYPE", "Chinese") |
| 21 |
} else { |
| 22 |
message("Locale was not changed.") |
| 23 |
} |
| 24 |
invisible(NULL) |
| 25 |
} |