Skip to content

jumpingrivers/pieR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R-CMD-check

pieR

A utility package for creating d3 pie charts based on the RStudio js tutorials.

Installation

You can install pieR from GitHub with:

# install.packages("devtools")
devtools::install_github("jumpingrivers/pieR")

Example

A couple of basic examples of the pie() function:

library("pieR")
pie(1:5)
pie(c(5, 5, 5))

A basic Shiny example

## Only run this in interactive R sessions
if(interactive()) {
  library("shiny")
  ui = fluidPage(
    titlePanel("Pie Example!"),
    sidebarLayout(
      sidebarPanel(
        sliderInput("obs", 
                    "Generate n random Numbers", 
                    min = 2, 
                    max = 10, 
                    value = 5)
      ),
      mainPanel(
        pieOutput("piePlot"),
        textOutput("randNo")
      )
    )
  )
  # Define the server code
  server = function(input, output) {
    numbers = reactive(round(runif(input$obs, 1, 10),0))
    output$piePlot = renderPie({
      pie(numbers())
    })
    output$randNo = renderText({
      numbers()
    })
  }
  shinyApp(ui = ui, server = server)
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages