Description Usage Arguments Value Author(s) Examples

When producing numbers in R markdown documents, it can be nice to try and
draw readers' attention to increases and decreases. The `html_tri`

function takes a numeric vector, and returns a `character`

vector of HTML strings, which will render in an (R) markdown document as
numbers accompanied with a green 'upward' triangle for positive numbers, a
red 'downward' triangle for negative ones, and a black square for numbers
which are exactly 0 by default. The colours can be altered by passing valid
CSS colour values to the `colours`

argument, and the symbols by
passing valid HTML character values to the `symbols`

argument. The
default values are in HTML decimal character codes.

If you'd only like to green/red triangles for some non-zero numbers, you
can use the subset argument to pass a `logical`

vector (the
same) length as `x`

to `html_tri`

. This will mean that only
elements of `x`

will get a traingle when they are non-negative
*and* `subset`

is `TRUE`

.

1 2 3 |

`x` |
A |

`format` |
A function used to format the numbers before the HTML for the triangles is added. |

`subset` |
A |

`symbols` |
The symbols to use for increases, decreases, and things
not chaning respectively. Must a a vector of length 3, the entries having
the names |

`colours` |
As above, but for the colours of the symbols |

A vector of `character`

values, containing HTML so that
they should render with green/red triangles in an HTML document.
values in `x`

.

Brendan Rocks [email protected]

1 2 3 4 5 6 7 8 9 10 11 | ```
# This will output 'raw' HTML. To see the final result in an HTML markdown
# document, see the package vignette; vignette("brocks")
html_tri(runif(10))
# You could use other HTML symbols, even emojis if you like!
# These are HTML decimal codes (only unicode allowed in R packages), but
# you could use any valid characters (e.g. copy and paste)
html_tri(runif(10), symbols = c("up" = "😊", "down" = "😞",
"nochange" = "😐"))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.