Skip to contents

Returns the rank (face value) of each card in a card vector.

Usage

card_rank(x)

Arguments

x

A card vector created using card().

Value

A character vector of ranks ("2"–"10", "J", "Q", "K", "A").

Details

This function returns character values from the rank field of each card. Input must be of class card; otherwise, an error is raised.

Examples

cards <- card(c("A", "10", "Q"), c("♠", "♥", "♦"))
card_rank(cards)  # "A" "10" "Q"
#> [1] "A"  "10" "Q"