-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
83 lines (60 loc) · 1.97 KB
/
README.Rmd
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# shinytangle
<!-- badges: start -->
[![R-CMD-check](https://github.com/coatless-rpkg/shinytangle/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/shinytangle/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
shinytangle provides inline interactive widgets for Shiny applications, allowing
you to embed interactive numeric inputs and outputs directly within text. This
makes it easy to create dynamic, interactive narratives and explanations where
users can adjust values and see results update in real-time.
## Installation
You can install the development version of shinytangle from GitHub:
```r
# install.packages("remotes")
remotes::install_github("coatless-rpkg/shinytangle")
```
## Usage
Here's an example of how to use shinytangle:
```{r}
#| eval: false
library(shiny)
library(shinytangle)
ui <- fluidPage(
titlePanel("shinytangle: Demo Inline"),
p(
"When you have",
inlineNumericInput("amount", 5, min = 0, max = 10),
"items, the total cost is",
inlineOutput("cost")
)
)
server <- function(input, output) {
output$cost <- renderInline({
input$amount * 9.99
})
}
shinyApp(ui, server)
```
![](https://github.com/user-attachments/assets/c96aa063-e38c-4f80-ab88-c0a1fe090525)
After installing the package, you can explore more examples of `shinytangle` by running:
```r
# Display a triangle and adjust its size with a,b,c sliders
shiny::runExample("triangle-demo", package = "shinytangle")
# Multi-text statement example
shiny::runExample("text-statement-demo", package = "shinytangle")
# Try out the README example
shiny::runExample("readme-inline-demo", package = "shinytangle")
# See a list of all examples:
system.file("examples-shiny", package="shinytangle")
```