A card trick in R