https://github.com/jumpingrivers/pier
https://github.com/jumpingrivers/pier
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jumpingrivers/pier
- Owner: jumpingrivers
- Created: 2017-10-19T15:38:49.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2022-09-28T10:46:44.000Z (over 3 years ago)
- Last Synced: 2025-01-15T23:25:23.667Z (over 1 year ago)
- Language: JavaScript
- Size: 256 KB
- Stars: 0
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output:
md_document:
variant: markdown_github
editor_options:
chunk_output_type: console
---
[](https://github.com/jumpingrivers/pieR/actions/workflows/R-CMD-check.yaml)
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# pieR
A utility package for creating d3 pie charts based on the RStudio js tutorials.
## Installation
You can install **pieR** from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("jumpingrivers/pieR")
```
## Example
A couple of basic examples of the `pie()` function:
```{r example1, results="hide", message=FALSE}
library("pieR")
pie(1:5)
pie(c(5, 5, 5))
```
# A basic Shiny example
```{r, eval = TRUE}
## 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)
}
```