Code Monkey home page Code Monkey logo

r2fireworks's Introduction

r2fireworks: Add/remove celebratory fireworks to your Rmarkdown and Shiny application

Installation and Library Attachment

The r2social package is available on CRAN and can be installed as shown below

remotes::install_github("oobianom/r2fireworks")

Attach library

library(r2social)

Shiny application

# simple example with automatic start
library(shiny)
library(r2fireworks)

ui <- fluidPage(
  useFireworks(),
  shiny::tags$h1("Introducing r2fireworks"),
  shiny::tags$p("Celebrate 4th of July and my R package!!!")
)
server <- function(input, output, session) {
# optional. start fireworks on load
  showFireworks(particleCount = 30)
}

shinyApp(ui, server)







# example with start and stop buttons
library(shiny)
library(r2fireworks)

ui <- fluidPage(
  useFireworks(),
  shiny::tags$h1("Here is the starts"),
  shiny::tags$p("Celebrate 4th of July and my R package!!!"),
  actionButton("startFW","Show and Start Fireworks, with speed x1"),
  actionButton("startFWx4","Show and Start Fireworks, with speed x4"),
  actionButton("startFWspx4","Show Fireworks, with particle burst size 10000"),
  actionButton("stopFW","Remove Fireworks")
)

server <- function(input, output, session) {
  observeEvent(input$startFW,{
    showFireworks()
  })

  observeEvent(input$startFWx4,{
    showFireworks(speed = 4,particleCount = 50)
  })

  observeEvent(input$startFWspx4,{
    showFireworks(speed = 1,particleCount = 10000)
  })
  observeEvent(input$stopFW,{
    removeFireworks()
  })
}


Rmarkdown document

  ---
  title: "r2fireworks: add celebratory fireworks to page"
  output:
    html_document:
      theme: default
  ---
  
  
  
  #### Example
  
  ``{r}
  library(r2fireworks)
  useFireworks()
  addRmdFireworks(particleCount = 30, speed = 3)
  ``

r2fireworks's People

Contributors

oobianom avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.