card: decks of 52 cards

Description Usage Arguments Examples

Description

Functions that extract information from a card

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
card_list()

card_suit(card = card_list())

card_rank(card = card_list())

card_style(card = card_list(), four_color = TRUE)

card_color(card = card_list(), four_color = TRUE)

card_html(card = card_list(), size = 172, four_color = TRUE)

card_specials()

card_htmlhex(card = card_list())

card_unicode(card = card_list())

Arguments

card

a card. A list of available cards can be found with card_list()

four_color

should a four color deck be applied. This means that each suit will have it's own color (black, red, blue and green). Otherwise, use two colors (black and red).

size

the font-size to use

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# show all valid cards
card_list()

# determine rank and suit and color
card_rank("Jc")
card_suit("7d")
card_color("Ad")
card_color("Ad", four_color = FALSE)

# style cards either in the console or via HTML
cat(card_unicode("5h"), "\n")
cat(card_style("5h"), "\n")
card_html("5h")

# iterate over several cards for styling
card_list() %>% sapply(card_style) %>% cat("\n")
card_list() %>% lapply(card_html, 70) %>% span() %>% browsable()

r-webutils/suitr documentation built on Dec. 23, 2021, 12:18 a.m.