Last active
August 29, 2015 14:15
Revisions
-
Charles Determan revised this gist
Feb 13, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ library(dplyr) library(ggvis) library(shiny) shinyServer( -
Charles Determan revised this gist
Feb 13, 2015 . 1 changed file with 37 additions and 36 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,40 +4,41 @@ shinyServer( function(input, output, session){ myData <- reactive({ # Filter the data based on user selection month date_seq <- seq(input$dates[1], input$dates[2], by = "day") EvolucionVisitas <- filter(Visitas_Por_Fuente, date %in% date_seq) return(EvolucionVisitas) }) ############# Evolución de las visitas ############################################## #####################################################################################** myvis <- reactive({ EvolucionVisitas <- myData() mysessions <- function(x) { if(is.null(x)) return(NULL) #notice below the id column is how ggvis can understand which session to show row <- EvolucionVisitas[EvolucionVisitas$id == x$id, ] #prettyNum shows the number with thousand-comma separator paste0("Sessions:", " ",prettyNum(row$sessions, big.mark=",",scientific=F)) } outvis <- EvolucionVisitas %>% ggvis(~factor(date), ~sessions, key := ~id) %>% layer_points() %>% add_tooltip(mysessions ,"hover") %>% layer_paths() %>% add_axis("x", title="Dates", value = c(as.character(EvolucionVisitas$date[1]), as.character(EvolucionVisitas$date[round(length(EvolucionVisitas$date)/2,0)]), as.character(tail(EvolucionVisitas$date, n=1)))) return(outvis) }) myvis %>% bind_shiny("EvolucionVisitas") } ) -
Charles Determan revised this gist
Feb 13, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ library(shiny) library(ggvis) shinyUI( # Use a fluid Bootstrap layout fluidPage( -
Charles Determan revised this gist
Feb 13, 2015 . 2 changed files with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ library(ggvis) library(shiny) shinyServer( function(input, output, session){ 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ library(shiny) shinyUI( # Use a fluid Bootstrap layout fluidPage( -
Charles Determan created this gist
Feb 13, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ Visitas_Por_Fuente <- structure(list(date = structure(1:31, .Label = c("2014-12-01", "2014-12-02", "2014-12-03", "2014-12-04", "2014-12-05", "2014-12-06", "2014-12-07", "2014-12-08", "2014-12-09", "2014-12-10", "2014-12-11", "2014-12-12", "2014-12-13", "2014-12-14", "2014-12-15", "2014-12-16", "2014-12-17", "2014-12-18", "2014-12-19", "2014-12-20", "2014-12-21", "2014-12-22", "2014-12-23", "2014-12-24", "2014-12-25", "2014-12-26", "2014-12-27", "2014-12-28", "2014-12-29", "2014-12-30", "2014-12-31" ), class = "factor"), sessions = c(1932L, 1828L, 2349L, 8192L, 3188L, 3277L, 2846L, 2541L, 5434L, 4290L, 2059L, 2080L, 2111L, 3776L, 1989L, 1844L, 3641L, 1283L, 1362L, 1568L, 2882L, 1212L, 957L, 851L, 928L, 1435L, 1115L, 1471L, 1128L, 1022L, 768L), id = 1:31), .Names = c("date", "sessions", "id"), row.names = c(NA, -31L), drop = TRUE, class = c("tbl_df", "tbl", "data.frame")) Visitas_Por_Fuente$date <- as.Date(Visitas_Por_Fuente$date) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ shinyServer( function(input, output, session){ myData <- reactive({ # Filter the data based on user selection month date_seq <- seq(input$dates[1], input$dates[2], by = "day") EvolucionVisitas <- filter(Visitas_Por_Fuente, date %in% date_seq) return(EvolucionVisitas) }) ############# Evolución de las visitas ############################################## #####################################################################################** myvis <- reactive({ EvolucionVisitas <- myData() mysessions <- function(x) { if(is.null(x)) return(NULL) #notice below the id column is how ggvis can understand which session to show row <- EvolucionVisitas[EvolucionVisitas$id == x$id, ] #prettyNum shows the number with thousand-comma separator paste0("Sessions:", " ",prettyNum(row$sessions, big.mark=",",scientific=F)) } outvis <- EvolucionVisitas %>% ggvis(~factor(date), ~sessions, key := ~id) %>% layer_points() %>% add_tooltip(mysessions ,"hover") %>% layer_paths() %>% add_axis("x", title="Dates", value = c(as.character(EvolucionVisitas$date[1]), as.character(EvolucionVisitas$date[round(length(EvolucionVisitas$date)/2,0)]), as.character(tail(EvolucionVisitas$date, n=1)))) return(outvis) }) myvis %>% bind_shiny("EvolucionVisitas") }) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ shinyUI( # Use a fluid Bootstrap layout fluidPage( # Give the page a title br(), br(), titlePanel("Visitas por fuente"), # Generate a row with a sidebar sidebarLayout( # Define the sidebar with one input sidebarPanel( dateRangeInput("dates", label = h3("Date range"), start = "2014-12-01", end = "2014-12-31") ), mainPanel( tabsetPanel( tabPanel('Evolución de las visitas', ggvisOutput("EvolucionVisitas")) ) ) ) ) )