-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7519a2d
commit 53cf192
Showing
48 changed files
with
252,084 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
^devstuff_history\.R$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^data-raw$ | ||
^devtools_history\.R$ | ||
devtstuff_history.R | ||
^devtstuff_history\.R$ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.Rproj.user |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Package: findyourdreamcar | ||
Title: A shiny template | ||
Version: 0.1.2 | ||
Authors@R: person("Vincent", "Guyader", email = "vincent@thinkr.fr", role = c("aut", "cre")) | ||
Description: A template for prod-ready Shiny App. | ||
License: GPL-3 | ||
Depends: | ||
R (>= 3.4.3) | ||
Imports: | ||
DT, | ||
glue, | ||
graphics, | ||
shiny, | ||
stats, | ||
dplyr, | ||
magrittr, | ||
RColorBrewer, | ||
readr, | ||
sf, | ||
ggplot2, | ||
raster, | ||
rasterVis | ||
Suggests: | ||
testthat, | ||
knitr, | ||
rmarkdown | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 6.1.1 | ||
VignetteBuilder: knitr |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(mod_advanced_filtering) | ||
export(mod_advanced_filteringUI) | ||
export(mod_basic_filtering) | ||
export(mod_basic_filteringUI) | ||
export(mod_csv_file) | ||
export(mod_csv_fileInput) | ||
export(run_app) | ||
import(dplyr) | ||
import(magrittr) | ||
import(shiny) | ||
importFrom(glue,glue) | ||
importFrom(graphics,hist) | ||
importFrom(shiny,addResourcePath) | ||
importFrom(shiny,shinyApp) | ||
importFrom(stats,rnorm) | ||
importFrom(utils,data) | ||
importFrom(utils,read.csv) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
`%||%` <- function (x, y) | ||
{ | ||
if (is.null(x)) | ||
y | ||
else x | ||
} | ||
#' return `TRUE` if in `production mode` | ||
app_prod <- function(){ | ||
getOption( "app.prod" ) %||% TRUE | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#' @import shiny | ||
#' @importFrom graphics hist | ||
#' @importFrom stats rnorm | ||
#' | ||
app_server <- function(input, output,session) { | ||
|
||
if ( app_prod() ){message("prod mode")}else{message("dev mode")} | ||
output$distPlot <- renderPlot({ | ||
x <- rnorm(1000) | ||
bins <- seq(min(x), max(x), length.out = input$bins + 1) | ||
hist(x, breaks = bins, col = 'darkgray', border = 'white') | ||
}) | ||
|
||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#' @import shiny | ||
app_ui <- function() { | ||
fluidPage( | ||
titlePanel("Find Your Dream Car"), | ||
sidebarLayout( | ||
sidebarPanel( | ||
mod_basic_filteringUI("fichier") | ||
), | ||
mainPanel( | ||
tabsetPanel(type = "tabs", | ||
tabPanel("Complementary Adjustments", | ||
# Left column with adjustment inputs | ||
column(6, | ||
mod_advanced_filteringUI("fichier") | ||
)), | ||
tabPanel("At 30 min drive", h5("")), | ||
tabPanel("In the whole country", h5("")) | ||
) | ||
) | ||
) | ||
) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#' @title mod_advanced_fileringUI and mod_advanced_filtering | ||
#' @description A shiny Module that allows the user to select the advanced filters | ||
#' | ||
#' @import dplyr | ||
#' @import magrittr | ||
#' @export | ||
#' @examples | ||
#' library(shiny) | ||
#' library(DT) | ||
#' if (interactive()){ | ||
#' ui <- fluidPage( | ||
#' mod_csv_fileInput("fichier"), | ||
#' DTOutput("tableau") | ||
#' ) | ||
#' | ||
#' server <- function(input, output, session) { | ||
#' data <- callModule(mod_csv_file,"fichier") | ||
#' output$tableau <- renderDT({data()}) | ||
#' } | ||
#' | ||
#' shinyApp(ui, server) | ||
#' } | ||
#' | ||
mod_advanced_filteringUI <- function(id) { | ||
|
||
ns <- NS(id) | ||
|
||
tagList( | ||
selectInput(ns("transmission"), "Choose the type of transmission:", choices = c("No Preference", cardata$transmission[!is.na(cardata$transmission)] %>% unique())), | ||
selectInput(ns("brand"), "Brand:", choices = c("No Preference", cardata$brand[!is.na(cardata$brand)] %>% unique() %>% sort())), | ||
sliderInput(ns("year_built"), "Year:", min = 1950, max = 2017, value = c(1950,2017)), | ||
sliderInput(ns("mileage"), "Mileage:", min = 10000, max = 100000, value = c(10000, 100000)), | ||
selectInput(ns("fuel"), "Type of fuel:", choices = c("No Preference", cardata$energie[!is.na(cardata$energie)] %>% unique() %>% sort())), | ||
selectInput(ns("nb_seats"), "Number of seats:", choices = c("No Preference", cardata$nb_places[!is.na(cardata$nb_places)] %>% unique() %>% sort())), | ||
selectInput(ns("nb_doors"), "Number of doors:", choices = c("No Preference", cardata$nb_portes[!is.na(cardata$nb_portes)] %>% unique() %>% sort())) | ||
) | ||
|
||
} | ||
|
||
|
||
#' mod_basic_filtering server function | ||
#' | ||
#' @param input internal | ||
#' @param output internal | ||
#' @param session internal | ||
#' | ||
#' @importFrom utils data | ||
#' @export | ||
#' @rdname mod_advanced_filteringUI | ||
mod_advanced_filtering <- function(input, output, session) { | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Naming convention : | ||
# all Shinymodule have to begin with `mod_`, in lowercase Except for `UI` , `Input` and `Output` | ||
# use `Input` as sufix if your module is an Input | ||
# use `Output` as sufix if your module is an Output | ||
# use `UI` as sufix if your module is both Input and Output | ||
# | ||
# examples : | ||
# ui side : mod_truc_bidulUI | ||
# server side : mod_truc_bidul | ||
# | ||
# ui side : mod_machin_chouetteInput | ||
# server side : mod_machin_chouette | ||
|
||
# all shinyModule must have a documentation page | ||
# one unique page for both ui and server side ( you can use `#' @rdname` to link both function) | ||
|
||
# A minimalist example is mandatory | ||
|
||
#' @title mod_basic_fileringUI and mod_basic_filtering | ||
#' @description A shiny Module that allows the user to select basic filters | ||
#' | ||
#' @import dplyr | ||
#' @import magrittr | ||
#' @export | ||
#' @examples | ||
#' library(shiny) | ||
#' library(DT) | ||
#' if (interactive()){ | ||
#' ui <- fluidPage( | ||
#' mod_csv_fileInput("fichier"), | ||
#' DTOutput("tableau") | ||
#' ) | ||
#' | ||
#' server <- function(input, output, session) { | ||
#' data <- callModule(mod_csv_file,"fichier") | ||
#' output$tableau <- renderDT({data()}) | ||
#' } | ||
#' | ||
#' shinyApp(ui, server) | ||
#' } | ||
#' | ||
mod_basic_filteringUI <- function(id) { | ||
|
||
ns <- NS(id) | ||
|
||
tagList( | ||
# Select Input for the Postal Code: | ||
selectInput(ns("city"), "Select your city:", choices = cardata$nom_commune %>% unique %>% sort()), | ||
|
||
# Select type of car: for the time being, choices are linked to factors taken by Carosserie in the first raw dataset | ||
selectInput(ns("carrosserie"), "Choose the type of car:", choices = cardata$carrosserie %>% unique()), | ||
|
||
# Action Button (to be automatized) | ||
actionButton(ns("go"), "Go") | ||
) | ||
|
||
} | ||
|
||
|
||
#' mod_basic_filtering server function | ||
#' | ||
#' @param input internal | ||
#' @param output internal | ||
#' @param session internal | ||
#' | ||
#' @importFrom utils data | ||
#' @export | ||
#' @rdname mod_basic_filteringUI | ||
mod_basic_filtering <- function(input, output, session) { | ||
|
||
#data("cardata") | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Naming convention : | ||
# all Shinymodule have to begin with `mod_`, in lowercase Except for `UI` , `Input` and `Output` | ||
# use `Input` as sufix if your module is an Input | ||
# use `Output` as sufix if your module is an Output | ||
# use `UI` as sufix if your module is both Input and Output | ||
# | ||
# examples : | ||
# ui side : mod_truc_bidulUI | ||
# server side : mod_truc_bidul | ||
# | ||
# ui side : mod_machin_chouetteInput | ||
# server side : mod_machin_chouette | ||
|
||
# all shinyModule must have a documentation page | ||
# one unique page for both ui and server side ( you can use `#' @rdname` to link both function) | ||
|
||
# A minimalist example is mandatory | ||
|
||
#' @title mod_basic_fileringUI and mod_basic_filtering | ||
#' @description A shiny Module that allows the user to select basic filters | ||
#' | ||
#' @import dplyr | ||
#' @import magrittr | ||
#' @export | ||
#' @examples | ||
#' library(shiny) | ||
#' library(DT) | ||
#' if (interactive()){ | ||
#' ui <- fluidPage( | ||
#' mod_csv_fileInput("fichier"), | ||
#' DTOutput("tableau") | ||
#' ) | ||
#' | ||
#' server <- function(input, output, session) { | ||
#' data <- callModule(mod_csv_file,"fichier") | ||
#' output$tableau <- renderDT({data()}) | ||
#' } | ||
#' | ||
#' shinyApp(ui, server) | ||
#' } | ||
#' | ||
mod_basic_filteringUI <- function(id) { | ||
|
||
ns <- NS(id) | ||
|
||
tagList( | ||
# Select Input for the Postal Code: | ||
selectInput(ns("city"), "Select your city:", choices = cardata$nom_commune %>% unique %>% sort()), | ||
|
||
# Select type of car: for the time being, choices are linked to factors taken by Carosserie in the first raw dataset | ||
selectInput(ns("carrosserie"), "Choose the type of car:", choices = cardata$carrosserie %>% unique()), | ||
|
||
# Action Button (to be automatized) | ||
actionButton(ns("go"), "Go") | ||
) | ||
|
||
} | ||
|
||
|
||
#' mod_basic_filtering server function | ||
#' | ||
#' @param input internal | ||
#' @param output internal | ||
#' @param session internal | ||
#' | ||
#' @importFrom utils data | ||
#' @export | ||
#' @rdname mod_basic_filteringUI | ||
mod_basic_filtering <- function(input, output, session) { | ||
|
||
#data("cardata") | ||
|
||
} |
Oops, something went wrong.