Description Usage Arguments Examples
View source: R/playing-cards.R
Playing cards
1 2 3 4 | playing_card(
suit = c("hearts", "spades", "diamonds", "clubs"),
value = c("a", 2:10, "j", "q", "k")
)
|
suit |
The name of the suit (e.g. |
value |
The value (e.g. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | if (interactive()) {
library(shiny)
library(shufflecards)
ui <- fluidPage(
tags$h3("Playing cards"),
fluidRow(
column(
width = 3,
"King of Heart",
playing_card("heart", "k")
),
column(
width = 3,
"Random:",
uiOutput("random"),
actionButton("draw", "Draw")
)
)
)
server <- function(input, output, session) {
output$random <- renderUI({
input$draw
playing_card(
sample(c("hearts", "spades", "diamonds", "clubs"), 1),
sample(c("a", 2:10, "j", "q", "k"), 1)
)
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.