This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| shinyServer(function(input, output) { | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) # load the shiny package | |
| library(ggplot2) # load the gglpot2 package if ploting using ggplot | |
| # beginning of the shiny server function | |
| shinyServer(function(output, input)({ | |
| # The following reactive function would return the column variable names corresponding to the dataset selected by the user. | |
| var <- reactive({ | |
| switch(input$data1, | |
| "mtcars" = names(mtcars), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| # define the leaflet map object | |
| leaflet() # this will just define the map widget | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Demonstrate how to use mutate to add a new variable (called average in this demo example) into dataframe which contains the results of a function (average or mean in this demo example) performed on each row of the specified variables in the dataframe. | |
| library(dplyr) | |
| # create a dummy dataframe for demostration purpose | |
| mydata = data.frame(x=c("99.15%", "98.75%", "99.52%"),y=c("96.25%", "91.55%", NA), z=c("90.10%", NA, "87.50%")) | |
| # look at the data | |
| str(mydata) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Mutate demo example#1" | |
| author: "Abhinav Agrawal" | |
| date: "January 11, 2016" | |
| output: html_document | |
| --- | |
| ```{r} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| # we use the renderLeaflet() at the server side for leaflet maps. | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| # define the leaflet map object | |
| leaflet() %>% | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| # define the leaflet map object | |
| leaflet() %>% | |
| addTiles() %>% | |
| setView(lng = 82.9739144,lat = 25.3176452, zoom = 2) %>% | |
| # Add a pop up to map by using addPopups() function | |
| addPopups(lng = 82.9739144, lat = 25.3176452, popup = "Varanasi - My Birth Place") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| ## renderLeaflet() is used at server side to render the leaflet map | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| # define the leaflet map object | |
| leaflet() %>% | |
| addTiles() %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| # define the leaflet map object | |
| leaflet() %>% | |
| addTiles() # this adds the base map tile - OSM (by default) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| library(leaflet) | |
| shinyServer(function(input, output) { | |
| output$mymap <- renderLeaflet({ | |
| input$update # catching the action button event | |
| isolate(leaflet() %>% | |
| addProviderTiles(input$bmap)) | |
OlderNewer