Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
woRkflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rushby
woRkflow
Commits
53492e40
Commit
53492e40
authored
4 years ago
by
Tom Rushby
Browse files
Options
Downloads
Patches
Plain Diff
How to shiny tutorial (WIP)
parent
157845b9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
howTo/shinyTutorial.Rmd
+93
-0
93 additions, 0 deletions
howTo/shinyTutorial.Rmd
with
93 additions
and
0 deletions
howTo/shinyTutorial.Rmd
0 → 100644
+
93
−
0
View file @
53492e40
---
title: "shinyTutorial"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Setup and required packages
Making API requests requires the following packages: `httr` and `jsonlite`. We can install/load these using our `loadLibraries` function (in our `woRkflow` package).
```{r libraries, message = FALSE, warning = FALSE}
library(woRkflow) # remember to build it first :-)
woRkflow::setup() # load env.R set up the default paths etc
reqLibs <- c("httr",
"jsonlite",
"knitr",
"tidyr",
"data.table", # data munching
"here", # here
"lubridate", # dates and times
"ggplot2", # plots
"bookdown" # for making reports (should also install knittr etc)
)
# load them
woRkflow::loadLibraries(reqLibs)
```
## Shiny apps and documents
Two types of Shiny implementation:
* Shiny app - a web appliacation based on R code
* Shiny document - an R Markdown document that can include dynamic elements by incorporating Shiny objects
### Layout
https://vimeo.com/rstudioinc/review/131218530/212d8a5a7a/#t=1h36m51s
Using the layout function produces html(as with tags$) .
Rows:
e.g. `fluidRow()` creates `<div class="row"></div>`
Each new row is placed beneath the previous one.
Columns (12 units wide - use arguments `width` and `offset` to control size and position):
e.g. `column(width = 2)` creates `<div class="col-sm-2"></div>`
`tags$h1()` # heading text (lvl 1) - use h1 to h6
`tags$p()` # paragraph
`tags$strong()`, `tags$em()` #
`tags$hr()` #
`tags$img()` # insert image - see <https://vimeo.com/rstudioinc/review/131218530/212d8a5a7a/#t=1h45m30s>
## Deployment
To deploy both apps and documents. Same process?
See bookdown site for deploying Shiny documents.
<https://bookdown.org/yihui/rmarkdown/shiny-deploy.html>
### shinyapps.io
Using shinyapps.io
https://vimeo.com/rstudioinc/review/131218530/212d8a5a7a/#t=0h30m45s
For example:
```{r}
rsconnect::deployApp('/Users/twr1m15/SotonGitLab/woRkflow/howTo/shiny/App', appName = "gridforecast",appTitle = "GB Grid Electricity Carbon Intensity Forecast Visualisation")
```
### RStudio connect
### Other methods
Other options are available: <https://www.r-bloggers.com/deploying-r-shiny-apps-using-shinyproxy-on-windows-10-2/>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment