library(ggplot2movies) library(jrShiny) movies = movies[!is.na(movies$budget) & movies$budget > 0,]
Select the year range and movie type
sliderInput("year", label = "Minimum year:", min=1930, max=2010, step=10, value=c(1930, 2010), sep="") selectInput("movie_type", label = "Movie genre", c("Romance", "Action", "Animation"))
renderPlot({ setnicepar() # Sets nice plotting region type = movies[,input$movie_type] == 1 x = movies$rating[movies$year >= input$year[1] & movies$year <= input$year[2] ] y = movies$length[movies$year >= input$year[1] & movies$year <= input$year[2]] plot(x, y, xlab="Rating", ylab="Length", xlim=c(1, 10), ylim=c(0, 400), pch=21, cex=1, bg=factor(type), col=NA) grid() })
```r renderText({ type = movies[,input$movie_type] == 1 paste("There are ", sum(type)) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.