2 |
3 |
8 |
9 |
Exploring the "Big mtcars" dataset
10 |
11 |
This application allows you to build your own dataviz for #TidyTuesday, 2019-10-15.
12 |
13 |
Tidy Tuesday is a weekly social data project in R. Find more about this project on rfordatasci.com and on the GitHub repo.
14 |
15 |
This week dataset is a larger version of the well-known mtcars
dataset. With this application, you'll be able to build your own {ggplot2}
graph out of this dataset.
16 |
17 |
On each plot, once it's rendered, you'll be able to see the code used by clicking on the image. You can use it as a starting point for more customisation.
18 |
19 |
For a deeper understanding of the dataset, feel free to unfold the data dictionnary on the bottom of this page.
20 |
21 |
22 |
You can also jump to:
23 |
24 |
32 |
33 |
47 |
48 |
49 |
50 | Click to display variable dictionnary.
51 |
52 | atvtype - type of alternative fuel or advanced technology vehicle
53 | barrels08 - annual petroleum consumption in barrels for fuelType1 (1)
54 | barrelsA08 - annual petroleum consumption in barrels for fuelType2 (1)
55 | charge120 - time to charge an electric vehicle in hours at 120 V
56 | charge240 - time to charge an electric vehicle in hours at 240 V
57 | city08 - city MPG for fuelType1 (2), (11)
58 | city08U - unrounded city MPG for fuelType1 (2), (3)
59 | cityA08 - city MPG for fuelType2 (2)
60 | cityA08U - unrounded city MPG for fuelType2 (2), (3)
61 | cityCD - city gasoline consumption (gallons/100 miles) in charge depleting mode (4)
62 | cityE - city electricity consumption in kw-hrs/100 miles
63 | cityUF - EPA city utility factor (share of electricity) for PHEV
64 | co2 - tailpipe CO2 in grams/mile for fuelType1 (5)
65 | co2A - tailpipe CO2 in grams/mile for fuelType2 (5)
66 | co2TailpipeAGpm - tailpipe CO2 in grams/mile for fuelType2 (5)
67 | co2TailpipeGpm- tailpipe CO2 in grams/mile for fuelType1 (5)
68 | comb08 - combined MPG for fuelType1 (2), (11)
69 | comb08U - unrounded combined MPG for fuelType1 (2), (3)
70 | combA08 - combined MPG for fuelType2 (2)
71 | combA08U - unrounded combined MPG for fuelType2 (2), (3)
72 | combE - combined electricity consumption in kw-hrs/100 miles
73 | combinedCD - combined gasoline consumption (gallons/100 miles) in charge depleting mode (4)
74 | combinedUF - EPA combined utility factor (share of electricity) for PHEV
75 | cylinders - engine cylinders
76 | displ - engine displacement in liters
77 | drive - drive axle type
78 | emissionsList
79 | engId - EPA model type index
80 | eng_dscr - engine descriptor; see http://www.fueleconomy.gov/feg/findacarhelp.shtml#engine
81 | evMotor - electric motor (kw-hrs)
82 | feScore - EPA Fuel Economy Score (-1 = Not available)
83 | fuelCost08 - annual fuel cost for fuelType1 ($) (7)
84 | fuelCostA08 - annual fuel cost for fuelType2 ($) (7)
85 | fuelType - fuel type with fuelType1 and fuelType2 (if applicable)
86 | fuelType1 - fuel type 1. For single fuel vehicles, this will be the only fuel. For dual fuel vehicles, this will be + the conventional fuel.
87 | fuelType2 - fuel type 2. For dual fuel vehicles, this will be the alternative fuel (e.g. E85, Electricity, CNG, + LPG). For single fuel vehicles, this field is not used
88 | ghgScore - EPA GHG score (-1 = Not available)
89 | ghgScoreA - EPA GHG score for dual fuel vehicle running on the alternative fuel (-1 = Not available)
90 | guzzler- if G or T, this vehicle is subject to the gas guzzler tax
91 | highway08 - highway MPG for fuelType1 (2), (11)
92 | highway08U - unrounded highway MPG for fuelType1 (2), (3)
93 | highwayA08 - highway MPG for fuelType2 (2)
94 | highwayA08U - unrounded highway MPG for fuelType2 (2),(3)
95 | highwayCD - highway gasoline consumption (gallons/100miles) in charge depleting mode (4)
96 | highwayE - highway electricity consumption in kw-hrs/100 miles
97 | highwayUF - EPA highway utility factor (share of electricity) for PHEV
98 | hlv - hatchback luggage volume (cubic feet) (8)
99 | hpv - hatchback passenger volume (cubic feet) (8)
100 | id - vehicle record id
101 | lv2 - 2 door luggage volume (cubic feet) (8)
102 | lv4 - 4 door luggage volume (cubic feet) (8)
103 | make - manufacturer (division)
104 | mfrCode - 3-character manufacturer code
105 | model - model name (carline)
106 | mpgData - has My MPG data; see yourMpgVehicle and yourMpgDriverVehicle
107 | phevBlended - if true, this vehicle operates on a blend of gasoline and electricity in charge depleting mode
108 | pv2 - 2-door passenger volume (cubic feet) (8)
109 | pv4 - 4-door passenger volume (cubic feet) (8)
110 | rangeA - EPA range for fuelType2
111 | rangeCityA - EPA city range for fuelType2
112 | rangeHwyA - EPA highway range for fuelType2
113 | trans_dscr - transmission descriptor; see http://www.fueleconomy.gov/feg/findacarhelp.shtml#trany
114 | trany - transmission
115 | UCity - unadjusted city MPG for fuelType1; see the description of the EPA test procedures
116 | UCityA - unadjusted city MPG for fuelType2; see the description of the EPA test procedures
117 | UHighway - unadjusted highway MPG for fuelType1; see the description of the EPA test procedures
118 | UHighwayA - unadjusted highway MPG for fuelType2; see the description of the EPA test procedures
119 | VClass - EPA vehicle size class
120 | year - model year
121 | youSaveSpend - you save/spend over 5 years compared to an average car ($). Savings are positive; a greater amount + spent yields a negative number. For dual fuel vehicles, this is the cost savings for gasoline
122 | sCharger - if S, this vehicle is supercharged
123 | tCharger - if T, this vehicle is turbocharged
124 | c240Dscr - electric vehicle charger description
125 | charge240b - time to charge an electric vehicle in hours at 240 V using the alternate charger
126 | c240bDscr - electric vehicle alternate charger description
127 | createdOn - date the vehicle record was created (ISO 8601 format)
128 | modifiedOn - date the vehicle record was last modified (ISO 8601 format)
129 | startStop - vehicle has start-stop technology (Y, N, or blank for older vehicles)
130 | phevCity - EPA composite gasoline-electricity city MPGe for plug-in hybrid vehicles
131 | phevHwy - EPA composite gasoline-electricity highway MPGe for plug-in hybrid vehicles
132 | phevComb - EPA composite gasoline-electricity combined city-highway MPGe for plug-in hybrid vehicles
133 |
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/inst/app/www/script.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 | $( ".row" ).hide();
3 | $( ".row" ).first().show();
4 | $( ".nav-link" ).first().addClass("active");
5 | var h = parseInt($('nav').outerHeight()) + 30;
6 | $(".row").css("padding-top", h + "px");
7 |
8 |
9 | })
--------------------------------------------------------------------------------
/inst/app/www/tech.md:
--------------------------------------------------------------------------------
1 | ## Tech used in this app
2 |
3 | + The [`{golem}`](https://github.com/ThinkR-open/golem) Framework was used to build the Shiny App backend.
4 |
5 | + The whole app is powererd by [`{shiny}`](https://github.com/rstudio/shiny).
6 |
7 | + Datavisualisation is done with [`{ggplot2}`](https://github.com/tidyverse/ggplot2)
8 |
9 | + The UI was built with [`Boostrap`](https://getbootstrap.com/)
10 |
11 | + The app was deployed on [RStudio Connect](https://rstudio.com/products/connect/)
12 |
13 | Browse the full source code at https://github.com/ColinFay/tidytuesday201942
14 |
--------------------------------------------------------------------------------
/inst/golem-config.yml:
--------------------------------------------------------------------------------
1 | default:
2 | golem_name: shinyexample
3 | golem_version: 0.0.0.9000
4 | app_prod: no
5 |
6 | production:
7 | app_prod: yes
8 |
9 | dev:
10 | golem_wd: !expr golem::pkg_path()
11 |
12 |
--------------------------------------------------------------------------------
/man/big_epa_cars.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/datasets.R
3 | \docType{data}
4 | \name{big_epa_cars}
5 | \alias{big_epa_cars}
6 | \title{big_epa_cars}
7 | \format{
8 | Tibble with 41,804 features and 83 fields
9 | }
10 | \usage{
11 | big_epa_cars
12 | }
13 | \description{
14 | Dataset from tidytuesday: rfordatascience/tidytuesday
15 | }
16 | \keyword{datasets}
17 |
--------------------------------------------------------------------------------
/man/mod_about.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mod_about.R
3 | \name{mod_about_ui}
4 | \alias{mod_about_ui}
5 | \alias{mod_about_server}
6 | \title{mod_about_ui and mod_about_server}
7 | \usage{
8 | mod_about_ui(id)
9 |
10 | mod_about_server(input, output, session)
11 | }
12 | \arguments{
13 | \item{id}{shiny id}
14 |
15 | \item{input}{internal}
16 |
17 | \item{output}{internal}
18 |
19 | \item{session}{internal}
20 | }
21 | \description{
22 | A shiny Module.
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/mod_dataviz.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mod_dataviz.R
3 | \name{mod_dataviz_ui}
4 | \alias{mod_dataviz_ui}
5 | \alias{mod_dataviz_server}
6 | \title{mod_dataviz_ui and mod_dataviz_server}
7 | \usage{
8 | mod_dataviz_ui(id, type = c("point", "hist", "boxplot", "bar"))
9 |
10 | mod_dataviz_server(input, output, session, type)
11 | }
12 | \arguments{
13 | \item{id}{shiny id}
14 |
15 | \item{input}{internal}
16 |
17 | \item{output}{internal}
18 |
19 | \item{session}{internal}
20 | }
21 | \description{
22 | A shiny Module.
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/mod_raw.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/mod_raw.R
3 | \name{mod_raw_ui}
4 | \alias{mod_raw_ui}
5 | \alias{mod_raw_server}
6 | \title{mod_raw_ui and mod_raw_server}
7 | \usage{
8 | mod_raw_ui(id)
9 |
10 | mod_raw_server(input, output, session)
11 | }
12 | \arguments{
13 | \item{id}{shiny id}
14 |
15 | \item{input}{internal}
16 |
17 | \item{output}{internal}
18 |
19 | \item{session}{internal}
20 | }
21 | \description{
22 | A shiny Module.
23 | }
24 | \keyword{internal}
25 |
--------------------------------------------------------------------------------
/man/pipe.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils-pipe.R
3 | \name{\%>\%}
4 | \alias{\%>\%}
5 | \title{Pipe operator}
6 | \usage{
7 | lhs \%>\% rhs
8 | }
9 | \description{
10 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
11 | }
12 | \keyword{internal}
13 |
--------------------------------------------------------------------------------
/man/run_app.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/run_app.R
3 | \name{run_app}
4 | \alias{run_app}
5 | \title{Run the Shiny Application}
6 | \usage{
7 | run_app(...)
8 | }
9 | \arguments{
10 | \item{...}{list of golem options}
11 | }
12 | \description{
13 | Run the Shiny Application
14 | }
15 |
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(tidytuesday201942)
3 |
4 | test_check("tidytuesday201942")
5 |
--------------------------------------------------------------------------------
/tests/testthat/test-golem-recommended.R:
--------------------------------------------------------------------------------
1 | context("golem tests")
2 |
3 | library(golem)
4 |
5 | test_that("app ui", {
6 | ui <- app_ui()
7 | expect_shinytaglist(ui)
8 | })
9 |
10 | test_that("app server", {
11 | server <- app_server
12 | expect_is(server, "function")
13 | })
14 |
15 | # Configure this test to fit your need
16 | test_that(
17 | "app launches",{
18 | skip_on_cran()
19 | skip_on_travis()
20 | skip_on_appveyor()
21 | x <- processx::process$new(
22 | "R",
23 | c(
24 | "-e",
25 | "setwd('../../'); pkgload::load_all();run_app()"
26 | )
27 | )
28 | Sys.sleep(5)
29 | expect_true(x$is_alive())
30 | x$kill()
31 | }
32 | )
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tidytuesday201942.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: pdfLaTeX
14 |
15 | BuildType: Package
16 | PackageUseDevtools: Yes
17 | PackageInstallArgs: --no-multiarch --with-keep.source
18 |
--------------------------------------------------------------------------------