View source: R/htmlSpecCharConv.R
htmlSpecCharConv | R Documentation |
Converts 'txt' so that (the most common) special characters (like 'beta','micro','square' etc) will be displayed correctly whe used for display in html (eg at mouse-over).
Note : The package stringi is required for the conversions (the input will get returned if stringi
is not available).
Currently only the 16 most common special characters are implemented.
htmlSpecCharConv(txt, silent = FALSE, callFrom = NULL, debug = FALSE)
txt |
character vector, including special characters |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
debug |
(logical) additional messages for debugging |
This function returns a corrected character vector adopted for html display
tables on https://www.htmlhelp.com/reference/html40/entities/latin1.html,
https://www.degraeve.com/reference/specialcharacters.php, or https://ascii.cl/htmlcodes.htm
## we'll use the package stringi to generate text including the 'micro'-symbol as input
x <- if(requireNamespace("stringi", quietly=TRUE)) {
stringi::stri_unescape_unicode("\\u00b5\\u003d\\u0061\\u0062")} else "\"x=axb\""
htmlSpecCharConv(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.