Repository navigation
Expand file tree
/
Copy pathtutorials.Rmd
More file actions
83 lines (53 loc) · 4.45 KB
/
Copy pathtutorials.Rmd
File metadata and controls
83 lines (53 loc) · 4.45 KB
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
81
82
---
title: "Shiny Tutorials"
output:
html_document:
toc: true
toc_depth: 3
toc_float:
collapsed: true
includes:
before_body: [includes/include_header.html, includes/include_header_navpage.html]
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE
)
```
<h2>Shiny Tutorials</h2>
Shiny is an R package that allows R users to create interactive web applications without needing to write any HTML, JavaScript or CSS. Building the most basic Shiny apps does not require that much practice or training, however Shiny apps can quickly become more complex and advanced as the list of desired features for your app increases. Advanced functionality typically comes under the following headings:
- Customising appearance of individual elements (colours, size and shape of elements)
- Customising the behaviour of controls (update control X when control Y is updated)
- Preventing updates unless a specific control has been changed (do not re-draw a map entirely unless X is changed)
- Remove/add controls or outputs in a Shiny app dependent on a control
This OxShef website contains a number of tutorials but should not be considered a resource that will get you from never using Shiny before to building advanced Shiny apps with all of the features above. The following external resources on Shiny are highly recommended:
- [RStudio's dedicated Shiny website](https://shiny.rstudio.com/articles/) contains articles on basic to extremely advanced topics like memory management.
- Lynda.com is a subscription learning service with an [introductory course on Shiny and interactive presentations](https://www.lynda.com/RStudio-tutorials/Creating-Interactive-Presentations-Shiny-R/452087-2.html) with RMarkdown ([Sheffield researchers](https://www.lynda.com/RStudio-tutorials/Creating-Interactive-Presentations-Shiny-R/452087-2.html?org=shef.ac.uk) and [Oxford researchers](https://www.lynda.com/RStudio-tutorials/Creating-Interactive-Presentations-Shiny-R/452087-2.html?org=ox.ac.uk) should use these links, respectively)
- Datacamp.com is a subscription learning service with a [course on building web applications with Shiny](https://www.datacamp.com/courses/building-web-applications-in-r-with-shiny).
**All tutorials assume you are using RStudio for writing R code**. RStudio provides a number of features that make it generally easier to develop Shiny apps than using the R Console.
# Shiny 101
<div class="row">
<div class="col-md-5">
The [Shiny 101 tutorial](tutorials_shiny101.html) introduces the very basics of a Shiny app by teaching you how to build the app you can see embedded here.
The code for this app is on [the Github repo](https://github.com/OxShef/oxshef_shiny/tree/master/tutorial-apps/shiny101) and the app is embedded into this page using a simple iframe, [see here for more details](deploy_shinyapps-io.html).
</div>
<div class="col-md-7">
<iframe src="https://trainingidn.shinyapps.io/OxShef_shiny_tutorials_shiny101/" width="100%" height="400px"></iframe>
</div>
</div>
# Controls dependent on data
Oftentimes controls should be dependent on the data being visualised, for instance restricting a list of countries from a dataset to a specific continent - selected by the user. This is slightly more complicated that you might initially imagine, as the `ui.R` file is by definition ignorant of any values from the `server.R` other than what is provided on the `output` object via `render*` functions.
The following example app is [explained in this tutorial](tutorials_controls-dependent-on-data.html). It makes use of the `gapminder` and `rnaturalearthhires` library to introduce the basics of both **interdependent** and **data dependent** controls. The code for this Shiny app is on [the Github repo](https://github.com/OxShef/oxshef_shiny/tree/master/tutorial-apps/controls-dependent-on-data) and the Shiny app is embedded into this page using a simple iframe, [see here for more details](deploy_shinyapps-io.html).
<iframe src="https://trainingidn.shinyapps.io/oxShef_shiny_tutorials_controls-depedendent-on-data/" width="100%" height="700px"></iframe>
<!--
# Shiny and htmlwidgets
# OxShef Specific Features/Customisations
There are a number of features/customisations made to the OxShef Shiny templates, these tutorials introduce how each of them work separately.
## Flashing and disappearing "loading data"
This does require some CSS
## Optional "Popout button" in menubar
--!>