Last updated: 2024-03-14
Checks: 2 0
Knit directory: for-future-reference/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version efbb8a5. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/shiny.Rmd
) and HTML
(docs/shiny.html
) files. If you’ve configured a remote Git
repository (see ?wflow_git_remote
), click on the hyperlinks
in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | ce0aa60 | John Blischak | 2019-04-11 | Build site. |
Rmd | 5d6218b | John Blischak | 2019-04-11 | Add notes on Shiny. |
Some notes on using Shiny from the DataCamp course Building Web Applications in R with Shiny:
To require that an input not be NULL
, put
req(input$n)
inside of the reactive function. This is
especially useful to avoid throwing an error before the user has a
chance to enter a value.
To select multiple values from a potentially long list, set
multiple = TRUE
for the UI function
selectInput()
. The default selectize = TRUE
will show potential values that update as the user types.
To optionally display output, put if (input$id)
inside of a render function. To include UI as well, use
conditionalPanel()
.
To obtain information on points from a plot, you can use:
plotOutput(brush = "id")
-> Server:
brushedPoints(df, brush = input$id)
plotOutput(hover = "id")
-> Server:
nearPoints(df, coordinfo = input$id)
Options for rendering text output:
textOutput()
(div tag) - use for normal textverbatimTextOutput()
(pre tag) - use to format as
codeIn UI, refer to IDs as strings. Order matters. In Server, refer to IDs as elements of list. Order doesn’t matter.
Download data - UI: downloadButton()
, Server:
downloadHandler()
Output arbitrary HTML that includes reactive components - UI:
outputUI()
, Server: renderUI()
To view reactlog, run options(shiny.reactlog = TRUE)
and click Ctrl+F3 while Shiny app is open.
observer versus reactive:
observe()
- automatically perform side effectreactive()
- automatically recalculate valueobserveEvent()
- perform side effect when
triggeredeventReactive()
- recalculate value when triggeredshinythemes:
themeSelector()
widget to UIui <- fluidPage(theme = shinytheme("cerulean"),
Can use individual HTML tags such as p()
,
br()
, etc. or directly write HTML with
HTML()
.