library("jrShiny") library("shiny")
File
, then New Project
. Create a new RStudio project in
an empty directory. Call it something useful like shiny_day1_practice
.File
, then New File
, then R markdown...
.my first app
1 + 1
Add the following widgets to your R markdown document, the options for each widget can be whatever you like at this stage:
selectInput()
sliderInput()
numericInput()
radioButtons()
, see ?radioButtons
for helpjrShiny::create_project()
. This should create two directories: original
and exercises
.exercises/chapter1/exercise4.Rmd
and run the script. renderText()
runif(n = input$n)
, display a plot of the random numbers using renderPlot()
iris
is an infamous dataset within the programming community. It contains widght and length measurements for the sepal
and petal
of three different flowers.
chapter1/exercise5.Rmd
and run. choices = unique(iris$Species)
doing?iris
data frame for the user's chosen species with the code selected = iris[iris$Species == input$flower_choice,]
renderText()
to add text that displays the average petal length for the species chosen by the user.Petal.Width
v Petal.Length
for the species chosen by the user.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.