Skip to contents

Returns the suit symbols (♠, ♥, ♦, ♣) of each card in a card vector.

Usage

card_suit(x)

Arguments

x

A card vector created using card().

Value

A character vector of suit symbols, one for each card.

Details

This function uses method dispatch to extract the suit field from the custom card class. If the input is not a card object, an informative error is thrown.

Examples

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