htmlSpecCharConv {wrMisc} | R Documentation |
Html Special Character Conversion
Description
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.
Usage
htmlSpecCharConv(txt, silent = FALSE, callFrom = NULL, debug = FALSE)
Arguments
txt |
character vector, including special characters |
silent |
(logical) suppress messages |
callFrom |
(character) allow easier tracking of messages produced |
debug |
(logical) additional messages for debugging |
Value
This function returns a corrected character vector adopted for html display
See Also
tables on https://www.htmlhelp.com/reference/html40/entities/latin1.html,
https://www.degraeve.com/reference/specialcharacters.php, or https://ascii.cl/htmlcodes.htm
Examples
## 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)