| 1 |
--- |
| 2 |
title: "Using Fonts" |
| 3 |
output: |
| 4 |
rmarkdown::html_vignette: |
| 5 |
latex_engine: xelatex |
| 6 |
vignette: > |
| 7 |
%\VignetteIndexEntry{Using Fonts} |
| 8 |
%\VignetteEngine{knitr::rmarkdown} |
| 9 |
%\VignetteEncoding{UTF-8} |
| 10 |
--- |
| 11 |
|
| 12 |
```{r setup, include = FALSE} |
| 13 |
knitr::opts_chunk$set( |
| 14 |
collapse = TRUE, |
| 15 |
comment = "#>" |
| 16 |
) |
| 17 |
``` |
| 18 |
|
| 19 |
One of the features of skim is the production of spark graphs for numeric data. |
| 20 |
However these graphs may not render properly because of lack of font support |
| 21 |
or for other reasons, such as an operating system that does not support UTF-8. |
| 22 |
In your specific environment this may depend on the fonts |
| 23 |
installed and the operating system and may occur for only |
| 24 |
specific types of documents such as PDF documents. |
| 25 |
Skimr supports kable() formatted tables, which is used in conjunction with |
| 26 |
fonts to render the spark graphs. |
| 27 |
|
| 28 |
To produce spark histograms a font that supports block elements must be used. To |
| 29 |
support the spark line graphs a font with Braille support must be used. |
| 30 |
|
| 31 |
Well-known fonts that support block elements include _DejaVu Sans_ and _Arial_. |
| 32 |
Their availability depends on your operating system. |
| 33 |
|
| 34 |
The yaml at the beginning of a document using custom fonts will generally be |
| 35 |
similar to that shown below. |
| 36 |
|
| 37 |
``` |
| 38 |
--- |
| 39 |
title: "Untitled" |
| 40 |
mainfont: DejaVu Sans |
| 41 |
output: |
| 42 |
html_document: default |
| 43 |
pdf_document: |
| 44 |
latex_engine: xelatex |
| 45 |
word_document: default |
| 46 |
font-family: Times New Roman |
| 47 |
--- |
| 48 |
``` |
| 49 |
|
| 50 |
|
| 51 |
A further discussion of this (with examples) is available in the |
| 52 |
"Using fonts" template for skimr. If you are using RStudio you can open that |
| 53 |
template by opening a new markdown file and selecting "From template" |
| 54 |
and then choosing it. Alternatively this file is available inside the |
| 55 |
skimr folder or repository at |
| 56 |
inst/markdown/templates/fonts_in_skimr/skeleton/skeleton.Rmd. |
| 57 |
|
| 58 |
If you are having difficulties making the spark graphs work, you can opt to turn |
| 59 |
them off using the code below. |
| 60 |
|
| 61 |
``` |
| 62 |
no_sparks <- skim_with(numeric = sfl(hist = NULL), ts = sfl(line_graph = NULL)) |
| 63 |
|
| 64 |
``` |