Type: | Package |
Title: | Symbols for 'Markdown' and 'Shiny' Application |
Version: | 1.4 |
Maintainer: | Obinna Obianom <idonshayo@gmail.com> |
Description: | Direct insertion of over 1000 symbols (e.g. currencies, letters, emojis, arrows, mathematical symbols and so on) into 'Rmarkdown' documents and 'Shiny' applications by incorporating 'HTML' hex codes. |
License: | MIT + file LICENSE |
URL: | https://r2symbols.obi.obianom.com |
BugReports: | https://github.com/oobianom/r2symbols/issues |
Depends: | R (≥ 3.4) |
Imports: | utils, htmltools, jsonlite |
Suggests: | rmarkdown, knitr, qpdf |
Encoding: | UTF-8 |
VignetteBuilder: | knitr |
Language: | en-US |
LazyData: | false |
RoxygenNote: | 7.2.1 |
NeedsCompilation: | no |
Packaged: | 2023-03-11 19:42:19 UTC; in198 |
Author: | Obinna Obianom [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2023-03-11 19:50:02 UTC |
Transform to html
Description
Transform string into HTML ready for Rmarkdown and Shiny
Usage
as.html(h)
Arguments
h |
string |
Value
HTML form of the string for easy insertion in Shiny or Rmarkdown documents
Examples
string <- "<b>smile</b>" #html b tag included to make the string bold
string_trans <- as.html(string)
cat(string) #when inserted in Rmarkdown will not show up as bolded
cat(string_trans) #when inserted into Rmarkdown will show up as bolded after knitting
Is string empty
Description
Return TRUE or FALSE after checking if a string is empty
Usage
is.empty(string)
Arguments
string |
the string to be checked |
Value
Returns TRUE or FALSE
Examples
string <- "r2resume"
string2 <- NULL
is.empty(string)
is.empty(string2)
Get a desired symbol
Description
Get a symbol by name or number for use in Rmarkdown or Shiny apps
Usage
sym(
...,
font.size = NULL,
font.weight = NULL,
font.color = NULL,
if.error = FALSE,
search.units.each = FALSE
)
Arguments
... |
the symbols to display |
font.size |
font size as integer |
font.weight |
font weight as integer |
font.color |
font color e.g. red, blue, cyan |
if.error |
error response |
search.units.each |
whether to search single letter columns |
Value
symbol hex for HTML displays
Examples
sym("trademark")
sym("alpha")
sym("arrow-right")
sym(144)
Symbol setting
Description
Font styling for symbols
Usage
sym.setting(font.size = NULL, font.weight = NULL, font.color = NULL)
Arguments
font.size |
font size as integer |
font.weight |
font weight eg. normal, bold or lighter |
font.color |
font color e.g. red, blue, cyan |
Value
No values returned
Examples
symbol.setting(40, "bold", "green") # ascribe settings for all symbols
symbol("alpha") # display the alpha symbol
symbol.setting() # clear settings for symbols
symbol("alpha") # display the alpha symbol
Fetch multiple symbols by category
Description
Fetch one or more symbols by category
Usage
symCat(
category,
font.size = NULL,
font.weight = NULL,
font.color = NULL,
if.error = TRUE
)
Arguments
category |
symbol categories to fetch (minimum: 4 characters) |
font.size |
font size as integer |
font.weight |
font weight as integer |
font.color |
font color e.g. red, blue, cyan |
if.error |
show error response |
Value
get symbols from matching a particular category
Categories include
arrows mixed chess check mark symbol animal emoji flag people skull sign star telephone weather zodiac smiley hourglass fraction cards triangle square
Examples
symCat("arrows")
symCat("smiley", font.size = 32)
symCat("music")
symCat("random") # should not work
Fetch multiple symbols by keyword
Description
Fetch one or more symbols by keyword
Usage
symKey(
keyword,
font.size = NULL,
font.weight = NULL,
font.color = NULL,
if.error = TRUE
)
Arguments
keyword |
symbol keyword to fetch |
font.size |
font size as integer |
font.weight |
font weight as integer |
font.color |
font color e.g. red, blue, cyan |
if.error |
show error response |
Value
get group of symbols maptching a particular keyword
Complete cheatcheat for symbols
Common symbols include alpha, beta, copyright, registered, theta, sigma. See the complete list at https://github.com/oobianom/r2symbols.
Examples
symKey("arrow", font.size = 45)
symKey("animal", font.color = "red")
symKey("random454")
symKey("show nothing")
Get a desired symbol
Description
Get a symbol by name or numberfor use in Rmarkdown or Shiny apps, could be a mathematical symbol or other kinds of symbols
Usage
symbol(
...,
font.size = NULL,
font.weight = NULL,
font.color = NULL,
if.error = FALSE,
search.units.each = FALSE
)
Arguments
... |
the symbols to display |
font.size |
font size as integer |
font.weight |
font weight as integer |
font.color |
font color e.g. red, blue, cyan |
if.error |
error response |
search.units.each |
whether to search single letter columns |
Value
symbol hex for HTML integration
Complete cheatcheat for symbols
Common symbols include alpha, beta, copyright, registered, theta, sigma. See the complete list at https://github.com/oobianom/r2symbols.
Examples
symbol("trademark")
symbol("alpha")
symbol("arrow-right")
symbol(144)
Symbol setting
Description
Font styling for symbols
Usage
symbol.setting(font.size = NULL, font.weight = NULL, font.color = NULL)
Arguments
font.size |
font size as integer |
font.weight |
font weight eg. normal, bold or lighter |
font.color |
font color e.g. red, blue, cyan |
Value
No values returned
Examples
symbol.setting(40, "bold", "green") # ascribe settings for all symbols
symbol("alpha") # display the alpha symbol
symbol.setting() # clear settings for symbols
symbol("alpha") # display the alpha symbol
Transform custom units
Description
Enter a unit and it will automatically be transformed to the appropriate form
Usage
symbol.units(units, error = FALSE)
Arguments
units |
the desired unit e.g ug/mL,pg/mL, ab, yL |
error |
whether to report any errors |
Value
Transformed units with substitution of symbols with appropriate symbol hex
Examples
symbol.units("ug/mL") # u will be transformed to mu
symbol.units("pg/mL") # no letter will be transformed
Symbol repository loader
Description
Loads all the available symbols
Usage
symload(
font.size = NULL,
font.weight = NULL,
font.color = NULL,
if.error = TRUE
)
Arguments
font.size |
font size as integer |
font.weight |
font weight as integer |
font.color |
font color e.g. red, blue, cyan |
if.error |
error response |
Value
No returns, but symbols are loaded
Examples
symload(40, "normal", "purple") # load symbols and add symbol settings
symload() # load symbols without custom settings
Transform HTML into symbols
Description
Transform texts in HTML to symbols
Usage
trans.r2symbols(
font.size = NULL,
font.weight = c("normal", "bold", "lighter"),
font.color = NULL
)
Arguments
font.size |
font size as integer |
font.weight |
font weight eg. normal, bold or lighter |
font.color |
font color e.g. red, blue, cyan |
Value
A rendered HTML where simple text is transformed to symbols using HTML codes
Note
This function simple inserts a script within the output HTML, which transforms the content using the relevant HTML codes.
Examples
trans.r2symbols()