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
|
ui.R
library(shiny)
library(datasets)
# Use a fluid Bootstrap layout
fluidPage(
# Give the page a title
titlePanel("Commerce Tunisien"),
# Generate a row with a sidebar
sidebarLayout(
# Define the sidebar with one input
sidebarPanel(
selectInput("annee", "Annee:",choices = c("1997","1998","1999","2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014")),
br(),
radioButtons("color","Choisir un couleur",choices = c("lightcoral","lightseagreen","springgreen3"),selected ="lightcoral" )
),
# Create a spot for the barplot
mainPanel(
plotOutput("myplot")
)
)
)
Server
library(shiny)
library(datasets)
# Define a server for the Shiny app
function(input, output) {
# Fill in the spot we created for a plot
output$myplot <- renderPlot({
plot(
datanv[,input$annee]*1000,
main=input$annee,
ylab="Valeur",
xlab="Variable", col =input$color)
})
} |
Partager