standard_deck {mmcards} | R Documentation |
Generate a Standard Deck of Playing Cards
Description
This function creates a standard deck of playing cards represented as a data frame. The deck includes suits, ranks, and values for each card.
Usage
standard_deck(
suits = c("C", "D", "H", "S"),
ranks = c("2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"),
values = seq(2, 14.75, by = 0.25)
)
Arguments
suits |
A character vector specifying the suits in the deck. Default is c('C', 'D', 'H', 'S') for Clubs, Diamonds, Hearts, and Spades. |
ranks |
A character vector specifying the ranks in the deck. Default is c('2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A') for ranks 2 to Ace. |
values |
A numeric vector specifying the values assigned to each card in the deck. Default is a sequence from 2 to 14.75 incremented by 0.25. |
Value
A data frame representing the deck of cards. The data frame has four
columns: rank
, suit
, card
, and value
. The data frame also has class
attributes "StandardDeck" and "data.frame".
Examples
deck <- standard_deck()
head(deck)
tail(deck)
[Package mmcards version 0.1.1 Index]