Package 'r2symbols'

Title: Symbols for 'Markdown' and 'Shiny' Application
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.
Authors: Obinna Obianom [aut, cre]
Maintainer: Obinna Obianom <[email protected]>
License: MIT + file LICENSE
Version: 1.4
Built: 2024-11-06 02:39:57 UTC
Source: https://github.com/oobianom/r2symbols

Help Index


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

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

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")

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()